Python variables, expressions, and data types

Python variables, expressions, and data types

9th - 12th Grade

20 Qs

quiz-placeholder

Similar activities

python quiz

python quiz

12th Grade

20 Qs

Python Variables and Data Types

Python Variables and Data Types

9th - 12th Grade

20 Qs

Python Basics

Python Basics

KG - University

16 Qs

Computer Science (Python)

Computer Science (Python)

9th Grade

18 Qs

Python_2R

Python_2R

KG - Professional Development

20 Qs

Python - Quiz

Python - Quiz

9th - 11th Grade

17 Qs

Python - List and Tuples

Python - List and Tuples

11th - 12th Grade

20 Qs

Python Basics Recap

Python Basics Recap

8th - 11th Grade

23 Qs

Python variables, expressions, and data types

Python variables, expressions, and data types

Assessment

Quiz

Computers

9th - 12th Grade

Easy

Created by

Brett Kottmann

Used 15+ times

FREE Resource

20 questions

Show all answers

1.

MATCH QUESTION

20 sec • 5 pts

Match the following values with their Python data types

float (decimal)

"Hello"

bool (boolean)

True

str (string)

4

int (integer)

7.3

2.

DRAG AND DROP QUESTION

20 sec • 5 pts

Order the below into the correct order for an assignment statement in Python. Not all options are used.

​ (a)   ​ (b)   ​ (c)  

x
=
7.3
/
@

3.

MULTIPLE SELECT QUESTION

20 sec • 5 pts

What are the two (2) preferred (as opposed to valid) naming styles for variables in Python?

Camel case

Traditional

Formal

Proper

Answer explanation

Media Image

Camel case (thisIsCamelCase) and traditional (this_is_traditional) are the two preferred ways to name variables.

Python, as a language, accepts all names that:

start with a letter (no numbers!) or underscore

do not contain any special characters except for underscores (_)

do not contain a space

4.

MATH RESPONSE QUESTION

20 sec • 5 pts

What is the result of the following Python print statement?

print(4 + 2 * 3 - 6)

Mathematical Equivalence

ON

Answer explanation

Follow PEMDAS: parenthesis, exponents, multiplication and division, addition and subtraction.

Do 2 * 3 first (6) then addition and subtraction from left to right:

4 + 6 = 10

10 - 6 = 4

5.

MULTIPLE SELECT QUESTION

30 sec • 5 pts

Which of the following are valid Python variable names?

4square

route66

home_address

studentAge

ver1.3

Answer explanation

Media Image

6.

MULTIPLE CHOICE QUESTION

30 sec • 5 pts

What will this code output?

print("confusion")

Confusion

confusion

Syntax Error

print

7.

MULTIPLE CHOICE QUESTION

20 sec • 5 pts

In the following code, what is happening?

foo = "bar"

A variable named foo is being created, with a value of "bar"

A variable named bar is being created, with a value of "foo"

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?