String
Write the code to print Hello to the console.
print("Hello")
What is an input in Python?
What is a variable?
Use to store something for later in the code.
Print("Hello")
print("Hello")
14 is this data type.
Integer
Write the code that would print I love coding! to the console.
True! Otherwise, whatever the person types gets lost.
What two things does a variable need?
A name and a value.
print("12")
print(12)
15.7 is this data type.
Write the code that prints a boolean to the console.
print(true)
Write the code that asks a user for their name.
userName = input ("What is your name?" )
Create a variable called yourName and set it equal it your name with correct code.
yourName = "Ms. Raynovich"
name="Mary"
print=name)
name="Mary"
print(name)
What is the short form for a true or false?
Bool
Write the code that would print a float to the console.
print(10.7)
What is casting in Python code?
Changing the data type from one to another.
Create a variable called fav_color and set it equal to your favorite color. Print it to the console.
fav_color = "blue"
print(fav_color)
favMovie="Jaws"
print("favMovie")
favMovie="Jaws"
print(favMovie)
Explain why this code wouldn't work. print("Hello" + 5)
You can't combine different data types.
Write a code that shows an addition operation which prints the answer 10 on the console.
print(5+5)
Write the code to ask the user for a number. Print it and add 3 to it. Make sure to cast it as an integer.
num = int (input ("Enter a number: "))
print (num + 3)
Set up your own variable name and value and print it to the console.
fav_animal="dog"
print(fav_animal)
best_day="Saturday"
print(bestDay)
best_day="Saturday"
print(best_day)