Level 8 Level 10
12 words 0 ignored
Ready to learn Ready to review
Check the boxes below to ignore/unignore words, then click save at the bottom. Ignored words will never appear in any learning session.
asks the user to input some data
answer = input()
puts the data the user has entered into the variable answer
prints something to the screen
prints the message 'Hello World!' to the screen
will give an error due to missing speech marks
print "Hello World"
will not print 'Hello World' but will give an error in Python 3.4.1 due to missing brackets
if answer = "yes":
has the wrong logical operator, it should be ==
if answer == "yes":
will compare the value of the variable answer to check if it is equal to the string"yes"
if answer == "yes"
will give an error as it is missing a colon at the end of the if statement.
while answer == "yes":
will check that the variable answer is equal to 'yes' and then continue to iterate through the while loop
while answer != "yes":
will only iterate through the while loop if the value of answer is not equal to 'yes'
while answer == "yes"
checks if answer is equal to yes and returns an error as it is missing a colon at the end of the while conditional statement.