Print function print function: prints objects- such as text or a number – onto screen or other output devices.
Print(“Hello world”) Print: “Hello W o rld “ and “H e y how are you” in different rows
Where would we use print
Print function: numbers
try P rinting : your age Y our favorite hobby and your favorite TV Show in two separate lines.
Variables and data types
variables
D ata types
practice 1. Create a variable called “course” and assign the name Quantum Computing 2. Create a variable called “age” and assign your age to it. P rint this variable
V ariable naming do’s U se lower case U se underscores to separate words in a variable name E xamples: G rocery_list M y_name city1 V ariable naming dont’s Cannot start with a number Cannot contain spaces Cannot contain special characters Cannot be a Python reserved word like ”with” or ”not”
P rinting variables and strings together
exercise C reate a var called “my_name” and assign your name to it. P rint the sentence “My name is {your name} Solution m y_name= Ben P rint(“My name is “ + my_name)
C reate a var called “class_size” and store the value 10 in it. U sing this variable , print the sentence “Size of class: 10” S olution C lass_size = 10 P rint(“Size of class: “ +str(class_size))