Test 8 Review

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

) What is output? new_list = [10, 20, 30, 40, 50] for i in new_list: print(i * 2)

20 40 60 80 100

What is output? new_list = [0, 1, 2, 3, 4] print(all(new_list)) print(min(new_list) + max(new_list))

False 4

What is output? my_list = [['cat in a hat'], ['Dr', 'Seuss']] print(my_list[1][1:])

['Seuss']

) What is output? new_list = [['abc', 'def'], 10, 20] print(new_list[0])

['abc', 'def']

What is output? new_list = ['python', 'development'] new_list.append('in progress') print(new_list)

['python', 'development', 'in progress']

What is output? my_var = ['python'] my_list = my_var[0].split() my_list += 'world' del my_list[1] print(my_list)

['python', 'o', 'r', 'l', 'd']

What is output? new_list = [10, 'ABC', '123', 25] my_list = new_list[:] new_list[2] = 16 print(new_list) print(my_list)

[10, 'ABC', 16, 25] [10, 'ABC', 16, 25]

What is output? new_list = [223, 645, 500, 10, 22] new_list.sort() for i in new_list: ind = new_list.index(i) if ind > 0: new_list[ind-1] += i print(new_list)

[32, 245, 723, 1145, 645]

What is output? new_list = [['hello', 'word'], 'good morning', 'have a nice day'] print(new_list[0:2])

[['hello', 'word'], 'good morning']

Complete the following code to print the average of the list. new_list = [0, 1, 2, 3, 4] XXX print(f'The average is {avg}')

avg = sum(new_list)/len(new_list)

What is output? my_list = [['a b c'], ['d e f']] new_list = my_list[0][0].split(' ') print(new_list[-2])

b

What is output? my_list = ['hello', 'good', 'morning'] print(my_list[1][:3])

goo

Choose the option that gives ['ABC', 'ABC'] as the output.

my_list = ['ABC', 'DEF'] my_list[len(my_list)-1] = 'ABC' print(my_list)

Choose the option that gives 'great' as the output.

my_list = ['books', 'are', 'great', 'for', 'learning'] my_list.sort() print(my_list.pop(3))

Which of the following code blocks will give 3 as the output?

my_list = [10, 10, 2, 5, 10] print(my_list.index(10) + my_list.count(10))

) Choose the correct syntax to complete the code below in order to print [1, 2, 3, 4, 5] as the output. my_list = [3, 2, 5] XXX print(my_list)

my_list.extend([1, 4]) my_list.sort()

Given a listmy_list = [[0, 1, 2], [3, 4, 5], [6, 7, 8]], how would you access the value 7?

my_list[2][1]

Select the code that gives ['cat in a hat', 'fluffy dogs', 1989, 1990] as the output.

new_list = ['1000', '2000', '3000', 'cat in a hat', 'fluffy dogs'] print(new_list[-2:] + [1989, 1990])

Choose the print statement that generates ['a', 'd'] as the output formy_list = ['a', 'b', 'c', 'd', 'e', 'f', 'g'].

print(my_list[0:-1:3])

Consider the listmy_list = [1880, '990EZ', 'Tax Forms']. Which statement gives '990EZ' as the output?

print(my_list[1])


Kaugnay na mga set ng pag-aaral

GEOL 4331: Intro To GIS: Exam I Review

View Set

Ch. 6 - Factors Contributing to False Memories

View Set

Personal finance Chapter 4 terms

View Set

Marketing Exam 3 Quiz, Marketing Test 2, MKTG 321 Ch 10 Final Exam

View Set