Edhesive 1.6 - 1.9 [Subscribe to youtube.com/oofer]

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

1.9 Code Practice

**Do the following activity directed

1.7 Lesson Practice Assume the user types in 7 and 10. What is output by the following? num1 = input ("Enter a number: ") num2 = input ("Enter a number: ") print (num1 + num2)

710

1.7 Lesson Practice In the previous lesson, we learned about different data types. The type function returns the type of data that you pass into it. For example, if a is a string, then print(type(a)) will print <class 'str'>. What is output by the following code? print(type("67")) print(type(67)) print(type("sixty-seven"))

<class 'str'> <class 'int'> <class 'str'>

1.7 Lesson Practice Which of the following is true about strings?

An input (unless otherwise specified) will be stored as a string

1.8 Lesson Practice _____________ data is what is translated to digital format so it can be stored in a computer.

Analog

1.6 Lesson Practice What is output by the following lines of code if we input the name "Sally"? n = input("What is your name?")print("Hello there " + n)

Hello there Sally

1.7 Lesson Practice What is wrong with the following code? num1 = int (input("Enter a number: ")) num2 = int (input("Enter a number: ")) num3 = int (input("Enter a number: ")) print ("The average is: " + (num1 + num2 + num3)/3)

It needs a str() command

1.6 Lesson Practice This code accepts a word as input, and then prints that word to the screen. w = input("Enter a word: ") print(w)

The number is printed.

1.7 Lesson Practice Which of the following is NOT true about variables?

The value stored by a variable cannot be changed after it is assigned.

1.8 Lesson Practice Using a microphone to record a sound on your computer is an example of:

analog to digital conversion

1.8 Code Practice Old Macdonald had a farm, E-I-E-I-O And on his farm he had a Python, E-I-E-I-O With a ssss-ssss here and a ssss-ssss there Here a ssss there a ssss Everywhere a ssss-ssss Old Macdonald had a farm, E-I-E-I-O

animal=input("Enter a animal sound: ") sound=input("Enter a sound: ") e="E-I-E-I-O" print('Old Macdonald had a farm, '+e) print('And on his farm he had a '+animal+', '+e) print('With a '+sound+'-'+sound+' here and a '+sound+'-'+sound+' there') print('Here a '+sound+' there a '+sound) print('Everywhere a '+sound+'-'+sound) print('Old Macdonald had a farm, '+e)

1.8 Lesson Practice Using an LCD projector to show an online video to a group of people is an example of:

digital to analog conversion

1.6 Code Practice: Question 2 Please input your first name: Please input your last name:

first=input("Please input your first name: ") last=input("Please input your last name: ") print(last+", "+first)

1.6 Lesson Practice Which of the following is a correct variable name?

low_Temperature

1.7 Lesson Practice Which of the following lines of code correctly inputs a number?

n = int(input ("Enter a value: "))

1.7 Code Practice: Question 2

num=int(input ("Enter a number: ")) print (num * 12)

1.7 Code Practice: Question 1 input ("Enter a number: ") print (num * 8)

num=int(input ("Enter a number: ")) print (num * 8)

1.7 Lesson Practice Which command converts a number to a string?

str

1.6 Code Practice: Question 1 Enter a word: Good Enter a word: morning Good morning

w = input("Enter a word: Good ") v = input("Enter a word: Morning ") print(w + " " + v)


संबंधित स्टडी सेट्स

CE Shop Section 2: Real Property Ownership

View Set

CHEM 31 - Chapter 1 (For Exam #1)

View Set

Security+ Network Security 20% (part 1)

View Set

Human Growth & Development Test:1

View Set

Domain 3B: Introduction to Risk Management

View Set

Emerson's "Self-Reliance" and "Nature"

View Set