ZyBook Flashcards

1
Q

What is a string literal?

A

text enclosed in quotes, either matching single or double quotes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What command sends output to the screen?

A

print

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What syntax adds a newline to a print statement?

A

\n
Or
print()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What does an empty print() statement do?

A

Makes a newline

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Assume variable age = 22, pet = “dog”, and pet_name = “Gerald”.

What is the output of
print(pet_name, ‘the’, pet, ‘is’, age)

A

Gerald the dog is 22

NOTE: no period at the end!!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What command gets characters from a user through a keyboard?

A

input()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What statement reads a user-entered string into variable num_cars?

A

num_cars = input()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Complete a statement that reads a user-entered string into variable my_var.

A

my_var = input()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly