Exam 1 Flashcards
What is wrong with the code snippet below?
print(Hello world)
Missing “ “ around Hello world
True or False: Python automatically inserts a newline character when you use the print command
True
Single line comment
#
Multiple line comment
’’’
What does the print statement do?
Sends your output to the screen
Which statement will print Hi! without a newline character?
print(“Hi!” , end= ‘ ‘)
How many arguments are in each of the following calls to the print function?
print(end= ‘ ‘)
print()
print(“Hi”,”there”)
print(“Hi there”)
print(“The quick brown fox” , “jumps” , “over the lazy” , “dog”, end= ‘\n’)
10215
True or False: the two names below refer to the same variable
My_Variable
my_variable
False
Declare the variable my_variable and assign it the value of “red” and assign another variable to overwrite this with “blue”
my_variable = “red”
my_variable = “blue”
What is the rule regarding boolean values in Python?
Boolean values in Python are case sensitive. They must start with a capital letter.
Strings
Collections of letters, numbers, and symbols
Boolean
True or False
Ints
Integers (no decimals)
Floats
Numbers with a decimal
Select the ways that a string can be declared
my_string = “I am a string”
my_string = “I am a string’
my_string = ‘“I am a string”’
my_string = ‘I am a string’
my_string = “I am a string”
my_string = ‘“I am a string”’
my_string = ‘I am a string’