What will this code output?
print("confusion")
Python variables, expressions, and data types

Flashcard
•
Computers
•
9th - 12th Grade
•
Hard
Quizizz Content
FREE Resource
Student preview

13 questions
Show all answers
1.
FLASHCARD QUESTION
Front
Back
confusion
2.
FLASHCARD QUESTION
Front
In the following code, what is happening?
foo = "bar"
Back
A variable named foo is being created, with a value of "bar"
3.
FLASHCARD QUESTION
Front
If foo is equal to 3 and x is equal to 4, what is the value of foo after this operation? foo = foo + x
Back
7
Answer explanation
When a variable is on the left side of the assignment operator (=) it is the place where the result is stored. When it is on the right side, it's value is used as part of the operation. Since foo is 3 and x is 4:
foo = foo + x
foo = 3 + 4
foo = 7
We say that 7 "overwrites" the old value of foo.
4.
FLASHCARD QUESTION
Front
In the following code, what value will be assigned to the variable "cat"?
mouse, cat, dog = "small", "medium", "large"
Back
medium
Answer explanation
As explained in the W3 Schools tutorial, when you have a list of variables and a list of values, the values are assigned in order to the variables.
Note that a list of values is NOT the same as a string of values!
foo, bar, bam = "one", "two", "three" <- this is a list of values
foo, bar, bam = "one, two, three" <- this is a string containing commas which look like a list
The second line will generate an error, as there are three variables, but only one text string.
5.
FLASHCARD QUESTION
Front
What will the following code output?
biff = 3.4
print(biff)
Back
3.4
Answer explanation
The print() function will print any type of variable.
6.
FLASHCARD QUESTION
Front
What is type casting?
Back
It allows a piece of data to have it's data type changed, e.g. an integer could be changed to a string.
7.
FLASHCARD QUESTION
Front
Which of the following input commands would allow the user to receive and store a string from the keyboard? Options: string = input("Please enter a string:") , string = int(input("Please enter a string:")) , string = float(input("Please enter a string:")) , string = bool(input("Please enter a string:"))
Back
string = input("Please enter a string:")
Create a free account and access millions of resources
Similar Resources on Quizizz
8 questions
AP CS A Flashcard 4 Practice

Flashcard
•
9th - 12th Grade
9 questions
PYTHON -- Lists (short)

Flashcard
•
9th - 12th Grade
10 questions
Arrays

Flashcard
•
10th - 12th Grade
12 questions
CSP-A114 Flashcard

Flashcard
•
9th - 12th Grade
12 questions
CS Python Fundamentals Unit 4 Review

Flashcard
•
9th - 12th Grade
9 questions
Reading and Writing Files with Python Intro

Flashcard
•
9th - 12th Grade
10 questions
Paper Practice 2

Flashcard
•
9th - 12th Grade
6 questions
lists/tuples

Flashcard
•
9th - 12th Grade
Popular Resources on Quizizz
15 questions
Multiplication Facts

Quiz
•
4th Grade
20 questions
Math Review - Grade 6

Quiz
•
6th Grade
20 questions
math review

Quiz
•
4th Grade
5 questions
capitalization in sentences

Quiz
•
5th - 8th Grade
10 questions
Juneteenth History and Significance

Interactive video
•
5th - 8th Grade
15 questions
Adding and Subtracting Fractions

Quiz
•
5th Grade
10 questions
R2H Day One Internship Expectation Review Guidelines

Quiz
•
Professional Development
12 questions
Dividing Fractions

Quiz
•
6th Grade
Discover more resources for Computers
25 questions
Spanish preterite verbs (irregular/changed)

Quiz
•
9th - 10th Grade
10 questions
Identify Slope and y-intercept (from equation)

Quiz
•
8th - 9th Grade
10 questions
Juneteenth: History and Significance

Interactive video
•
7th - 12th Grade
8 questions
"Keeping the City of Venice Afloat" - STAAR Bootcamp, Day 1

Quiz
•
9th - 12th Grade
26 questions
June 19th

Quiz
•
4th - 9th Grade
20 questions
Distance, Midpoint, and Slope

Quiz
•
10th Grade
20 questions
Figurative Language Review

Quiz
•
10th Grade
27 questions
STAAR English 1 Review

Quiz
•
9th Grade