Search Header Logo

day 2

Authored by yousof diaa

Computers

University

Used 3+ times

day 2
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE SELECT QUESTION

30 sec • 1 pt

1. What is the correct way to declare an empty list in Python?

my_list = {}
my_list = [ ]
my_list = list( )

my_list = list[]

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

2. In Python, how do you access the value associated with the key 'age' in the dictionary person?

person.age
person['age']
person.get('age')
person['name']

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

x = "moyo"

for( i in x) :

print(i)
predict output ?

m o y o

moyo

m
o
y
o

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

my_dict = {'apple': 3, 'banana': 2, 'orange': 5}
result = len(my_dict.keys())

result2 = len(my_dict)
print(result, result2)

3,6

6,3

3,3

error

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

5.how to print a dictionary in Python?

print(dictionary_name{})

print(dictionary_name)
display(dictionary_name)
show(dictionary_name)

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

n = 1

while(n>0) :

n = n+1

what happens ?

infinite loop

the loop doesnt start

n reaches 1000 and stops

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

7. What does the append function do with a list in Python?

it adds an element into the beginning of the list

It reverses the order of the elements in the list.
It creates a new list with the appended element.
It adds an element to the end of the list.

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?