Search Header Logo

Creating Lists in Python_v1

Authored by Kevin Tinsley

Instructional Technology

University

Used 2+ times

Creating Lists in Python_v1
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

19 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the syntax for creating a list in Python?

list = [1, 2, 3]

list = {1, 2, 3}

list = (1, 2, 3)

list = <1, 2, 3>

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is a list of float values?

[48.0, 30.5, 20.2, 100.0, 42.0]

["staff", "hat", "shoes"]

["The Holy Grail", 1975, 9.99]

[]

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Identify the list that contains string values.

[48.0, 30.5, 20.2, 100.0, 42.0]

["staff", "hat", "shoes"]

["The Holy Grail", 1975, 9.99]

[]

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What type of values does the list 'movie' contain?

Strings

Integers

Floats

Booleans

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following code snippet? temps = [48.0, 30.5, 20.2, 100.0, 42.0] temp = temps[0]

A) 48.0

B) 30.5

C) 20.2

D) IndexError

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What error will occur if you try to access temps[5] in the following list? temps = [48.0, 30.5, 20.2, 100.0, 42.0]

IndexError: index out of range

TypeError: list indices must be integers

ValueError: invalid literal for int()

KeyError: 5

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the value of 'item' after executing the following code? inventory = ["staff", "hat", "shoes", "bread", "potion", "scroll"] item = inventory[3]

staff

hat

bread

scroll

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?