Python 1 Flashcards
Can you name two of the most basic functions in Python?
print ( ) Input ( )
What does the Print function do in Python?
It allows the computer program to communicate with the user by displaying information on screen.
When assigning names to variables, should they be written in uppercase, lowercase or a mixture of both?
Variables should be written in lowercase
How should different words be connected when writing names for variables?
With underscores
What character precedes a comment?
#
How would you include quotation marks when using the print command? For example how would you print to screen the below text?
he said it is a “beautiful day” in his country
A back slash is used before the special characters,
print (“he said it is a "beautiful day" in his country”)
How is a variable assigned in Python? (String)
In your example assign the word ‘Guitar’ to a variable called ‘Instrument’
instrument = “Guitar”
What two commands would set Peter to the variable name and then print it to screen.
name = “Peter”
print (name)
Name two of the most common errors that Python will return
SyntaxError
NameError
What is a floating number (or a float)?
A floating number is a decimal number.
How is a variable assigned in Python (Integer or float)
In your example assign an integer and a float number to a variable called ‘value_int and value _float’
value_int = 9
value_float = 9.1