Python Coding Flashcards
How would you explain Python coding?
It is a high-level programming language
What is missing from this line of code?
print(“hello what is your first name?)
Missing a “ at the end
What does the code below do?
username = input (“please enter your username”)
Asks a user for their username and then stores it in the variable called username
What does this line of Python code do?
//welcome to my quiz
Nothing - it is a comment
Describe is a syntax error?
When the code has a spelling mistake or missing punctuation in the code
Float is a data type. What is it used for?
Decimal numbers
Integer is a data type. What is it used for?
Whole numbers
String is a data type. What is it used for?
Text
What is the best data type for a phone number?
String
What is the best data type for a shoe size?
Float
When this code has run, what value does the variable total contain?
number_one = 12
number_two = 4
total = number_one + number_two
16
number_one = “12”
number_two = “4”
total = number_one + number_two
124 - they are both strings as they are in “ “ so joined together as a string rather than added
What is missing from the code below
if score == 10
print (“well done”)
Missing : at the end of the if statement
Why do we use comments in coding?
To explain what the code does
What is this called when we join two or more words together?
print (“score” + score + “out of 100”)
Concatenation