Search Header Logo

Python -- Numbers and Inputs

Authored by Jami Campbell

Computers

9th - 12th Grade

Used 3+ times

Python -- Numbers and Inputs
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

7 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Review the following lines of code:

x = 4

y = "Sally"

Identify each variable's data type

x is an int

y is an int

x is an int

y is a str

x is a float

y is a str

x is a str

y is an int

x is an int

y is a float

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Based on the following lines of code...

x = 4

y = str(4) #casts y as a str

print(x)

print(y)

what will be displayed in the console?

TIP: single quotes have been added just to differentiate the str data types

x

y

4

'4'

4

4

'4'

4

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Based on the following lines of code...

x = 5

y = float(5) #casts y as a float

print(x)

print(y)

what will be displayed in the console?

TIP: single quotes have been added just to differentiate the str data type

x

y

'5'

5.0

5

5.0

5.0

5

4.

MULTIPLE SELECT QUESTION

2 mins • 1 pt

Based on these variables:

player = "Johnny"

jerseyNum = 12

position = "Guard"

Which lines of code would produce the following console message (HINT: more than one option is correct):

Johnny wears #12 and plays Guard.

print((player + " wears #" + (str)jerseyNum + " and plays " + position + "."))

print(f'{player} wears #{jerseyNum} and plays {position}.')

print(f'{Johnny} wears #{12} and plays {Guard}.')

print({player} wears #{jerseyNum} and plays {position}.)

print(player + " wears #" + jerseyNum + " and plays " + position + ".")

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Based on the following lines of code...

x = 5

y = x * 3

print(y)

what will be displayed in the console?

15

5 * 3

555

333

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Based on the following lines of code...

x = str(5) #casts x to a str

y = x * 3

print(y)

what will be displayed in the console?

15

5 * 3

555

333

7.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

We want to define a variable named age based on the number a user enters in the console.

Which of the following lines of codes would correctly create the variable?

(HINT: more than one option is correct)

age = input("What's your age? ")

age = num(input("What's your age? "))

age = float(input("What's your age? "))

age (f'What's your age? )

age = int(input("What's your age? ")

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?