click below
click below
Normal Size Small Size show me how
SStrPython 1-3
Graves Skill Struck Python 1-3
| Code | Result | |
|---|---|---|
| print “Hello World” | Needs ( ) | |
| print (Hello World) | Needs quotes | |
| print = (“Hello World”) | Doesn't need = | |
| print (“Hello World”) | This is correct output | |
| favorite_color = Red print (favorite_color) | Needs quotes | |
| Favorite_color = "Red" print (Favorite_color) | Needs lowercase f | |
| favorite color = Red print (favorite color) | Needs _ and quotes | |
| favorite_color = (Red) print (favorite_color) | Needs " " instead of ( ) | |
| favorite_number = 13 print (favorite_number) | The variable gets the value of the integer | |
| favorite_number = thirteen print (favorite_number) | Needs quotes | |
| flavor = input ("What's your favorite ice cream flavor?") print ("Your favorite flavor is " + flavor) | This is correct input and output | |
| # print = “Hello World” | Nothing appears in the console. Debugging--deactivates code for testing | |
| # This is a comment. | Nothing appears in the console. This is information for coders only | |
| 3fruits = "bananas" | Will give an error--beginning of the variable name is invalid | |
| school@ = "5850 Euclid" | Will give an error--variable name contains invalid characters | |
| tvShow = input("What's your favorite tv show?") | Prompts the user and stores the value in the variable | |
| print ("Your lucky number is: " color) | Creates an error because it needs something to print the variable | |
| print ("Your favorite flower is: " + flower") | Creates an error because there are too many quotes | |
| print ("Your pet's name is: " + petname) | Will print the message in quotes along with the variable |