Level 8 Level 10
Level 9

Common programming lines


12 words 0 ignored

Ready to learn       Ready to review

Ignore words

Check the boxes below to ignore/unignore words, then click save at the bottom. Ignored words will never appear in any learning session.

All None

Ignore?
input()
asks the user to input some data
answer = input()
puts the data the user has entered into the variable answer
print()
prints something to the screen
print("Hello world!")
prints the message 'Hello World!' to the screen
print(Hello world)
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.