Python Coding Flashcards
How would you describe Python?
It is a high level programming language
What is a variable?
Variables are containers for storing data values
What is missing from this line of code?
print(“hello world”
it is missing a )
What is a syntax error?
When the code has a spelling mistake or missing punctuation in the code
PRINT is an example of what programming technique?
Sequence
WHILE is an example of what programming technique?
Iteration
IF ELSE is an example of what programming technique?
Selection
What does iteration actually mean?
Loop
name = input (“what is your name”)
Where does the user’s entry get saved?
Saved in the variable called name
When this code has run, what value does total contain?
number_one = 10
number_two = 4
total = number_one + number_two
14
When this code has run, what value does total contain?
number_one = “10”
number_two = “4”
total = number_one + number_two
104 - as they have “ “ round them they are strings not integers
score = 100
What does this line of Python code do?
Nothing, it’s a comment
What is the syntax error in the code below?
Print (score)
Print needs to be in lower case - print (score)
Explain why the code below will cause a syntax error.
if age > 12:
print(“Sorry you are too old”)
The second line needs to be indented as it follows an if statement
What do you use if you have more than one IF command?
elif would be used which stands for ‘else if’