Assignment: Python List Exercises for AI Fundamentals Course
VerifiedAdded on 2022/09/06
|36
|5753
|28
Homework Assignment
AI Summary
This assignment is a Python programming exercise focused on understanding and manipulating lists, a fundamental data structure in Python. The task requires students to analyze code snippets that utilize the `list()` function, list indexing, slicing, and common list methods like `append()`, `extend()`, `insert()`, and `remove()`. For each code block, students must select the correct output from a multiple-choice list and describe the action being performed by the code. The exercises cover various scenarios, including creating lists from strings, tuples, and other lists, determining the length of lists, accessing elements using indices, modifying lists through assignment and method calls, and deleting elements. The assignment aims to reinforce students' understanding of list operations and their application in Python programming, which is crucial for AI fundamentals. Students are expected to submit their completed Python script file along with their answers. This document, available on Desklib, provides a comprehensive set of exercises and solutions to aid in the learning process.

Walk through the exercises in the attached pdf, select the appropriate answer, describe
the action and upload the completed python script file
Select the appropriate output after running the following code block:
list ("abc")
Group of answer choices
abc
"abc"
['a', 'b', 'c']
a,b,c
Question 21 pts
Describe the action being executed by the former code block:
list() will take each character of “abc” and make a list.
Question 31 pts
Select the appropriate output after running the following code block:
list ((1,2,3))
Group of answer choices
1, 2, 3
(1,2,3)
123
the action and upload the completed python script file
Select the appropriate output after running the following code block:
list ("abc")
Group of answer choices
abc
"abc"
['a', 'b', 'c']
a,b,c
Question 21 pts
Describe the action being executed by the former code block:
list() will take each character of “abc” and make a list.
Question 31 pts
Select the appropriate output after running the following code block:
list ((1,2,3))
Group of answer choices
1, 2, 3
(1,2,3)
123
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

[1, 2, 3]
Question 41 pts
Describe the action being executed by the former code block:
list() take each element and make a list
Question 51 pts
Select the appropriate output after running the following code block:
list([1,3,5,7,9])
Group of answer choices
1, 3, 5, 7, 9
[1, 3, 5, 7, 9]
13579
(1, 3, 5, 7, 9)
Question 61 pts
Describe the action being executed by the former code block:
list() take each element and make a list.
Flag this Question
Question 71 pts
Select the appropriate output after running the following code block:
empty_list = []
print(len(empty_list))
Group of answer choices
0
15
Question 41 pts
Describe the action being executed by the former code block:
list() take each element and make a list
Question 51 pts
Select the appropriate output after running the following code block:
list([1,3,5,7,9])
Group of answer choices
1, 3, 5, 7, 9
[1, 3, 5, 7, 9]
13579
(1, 3, 5, 7, 9)
Question 61 pts
Describe the action being executed by the former code block:
list() take each element and make a list.
Flag this Question
Question 71 pts
Select the appropriate output after running the following code block:
empty_list = []
print(len(empty_list))
Group of answer choices
0
15

empty_list
len(empty_list)
Question 81 pts
Describe the action being executed by the former code block:
Because the list is empty, size is 0
Question 91 pts
Select the appropriate output after running the following code block:
another_empty_list=list ()
print(len(another_empty_list))
Group of answer choices
24
len(another_empty_list)
0
another_empty_list
Question 101 pts
Describe the action being executed by the former code block:
Because the list doesn’t contain any element
Question 111 pts
Select the appropriate output after running the following code block:
list("house")
Group of answer choices
house
h,o,u,s,e
['h', 'o', 'u', 's', 'e']
len(empty_list)
Question 81 pts
Describe the action being executed by the former code block:
Because the list is empty, size is 0
Question 91 pts
Select the appropriate output after running the following code block:
another_empty_list=list ()
print(len(another_empty_list))
Group of answer choices
24
len(another_empty_list)
0
another_empty_list
Question 101 pts
Describe the action being executed by the former code block:
Because the list doesn’t contain any element
Question 111 pts
Select the appropriate output after running the following code block:
list("house")
Group of answer choices
house
h,o,u,s,e
['h', 'o', 'u', 's', 'e']
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

'h', 'o', 'u', 's', 'e'
Question 121 pts
Describe the action being executed by the former code block:
list() function will take each character of “house” and make a list.
Question 131 pts
Select the appropriate output after running the following code block:
list("This word")
Group of answer choices
This word
'T', 'h', 'i', 's', ' ', 'w', 'o', 'r', 'd'
['T', 'h', 'i', 's', ' ', 'w', 'o', 'r', 'd']
T,h,i,s , W,o,r,d
Question 141 pts
Describe the action being executed by the former code block:
list() will take each character of “this word” and make a list including space.
Question 151 pts
Select the appropriate output after running the following code block:
aTuple =('ready','fire','aim')
list(aTuple)
Group of answer choices
[ready, fire, aim]
'ready', 'fire', 'aim'
('ready', 'fire', 'aim')
Question 121 pts
Describe the action being executed by the former code block:
list() function will take each character of “house” and make a list.
Question 131 pts
Select the appropriate output after running the following code block:
list("This word")
Group of answer choices
This word
'T', 'h', 'i', 's', ' ', 'w', 'o', 'r', 'd'
['T', 'h', 'i', 's', ' ', 'w', 'o', 'r', 'd']
T,h,i,s , W,o,r,d
Question 141 pts
Describe the action being executed by the former code block:
list() will take each character of “this word” and make a list including space.
Question 151 pts
Select the appropriate output after running the following code block:
aTuple =('ready','fire','aim')
list(aTuple)
Group of answer choices
[ready, fire, aim]
'ready', 'fire', 'aim'
('ready', 'fire', 'aim')
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

['ready', 'fire', 'aim']
Question 161 pts
Describe the action being executed by the former code block:
list() converted the tuple into list.
Question 171 pts
Select the appropriate output after running the following code block:
aStringOf= "This is a string of "
aList=aStringOf.split(' ')
print(aList)
Group of answer choices
[This, is, a, string, of, ]
This is a string of
['This', 'is', 'a', 'string', 'of', '']
('This', 'is', 'a', 'string', 'of', '')
Question 181 pts
Describe the action being executed by the former code block:
split() function splits the list where space occurred and converts to list.
Question 191 pts
Select the appropriate output after running the following code block:
aDayString="5/1/2017"
aList=aDayString.split('/')
print(aList)
Group of answer choices
'5', '1', '2017'
Question 161 pts
Describe the action being executed by the former code block:
list() converted the tuple into list.
Question 171 pts
Select the appropriate output after running the following code block:
aStringOf= "This is a string of "
aList=aStringOf.split(' ')
print(aList)
Group of answer choices
[This, is, a, string, of, ]
This is a string of
['This', 'is', 'a', 'string', 'of', '']
('This', 'is', 'a', 'string', 'of', '')
Question 181 pts
Describe the action being executed by the former code block:
split() function splits the list where space occurred and converts to list.
Question 191 pts
Select the appropriate output after running the following code block:
aDayString="5/1/2017"
aList=aDayString.split('/')
print(aList)
Group of answer choices
'5', '1', '2017'

['5', '1', '2017']
('5', '1', '2017')
"5/1/2017"
Question 201 pts
Describe the action being executed by the former code block:
split() function splits the list where ‘/’ occurred and converts to list.
Question 211 pts
Select the appropriate output after running the following code block:
l_lists=[[1,2,3],[2,3,4],[3,4,5]]
new_llists=[element[1:] for element in l_lists]
i=0
for element in new_llists:
print(element)
i=i+1
if i==3:
break
Group of answer choices
2, 3, 3, 4, 4, 5
(2, 3) (3, 4) (4, 5)
2, 3 3, 4 4, 5
[2, 3] [3, 4] [4, 5]
Question 221 pts
Describe the action being executed by the former code block:
element[1:] means element[1] to element[2]
('5', '1', '2017')
"5/1/2017"
Question 201 pts
Describe the action being executed by the former code block:
split() function splits the list where ‘/’ occurred and converts to list.
Question 211 pts
Select the appropriate output after running the following code block:
l_lists=[[1,2,3],[2,3,4],[3,4,5]]
new_llists=[element[1:] for element in l_lists]
i=0
for element in new_llists:
print(element)
i=i+1
if i==3:
break
Group of answer choices
2, 3, 3, 4, 4, 5
(2, 3) (3, 4) (4, 5)
2, 3 3, 4 4, 5
[2, 3] [3, 4] [4, 5]
Question 221 pts
Describe the action being executed by the former code block:
element[1:] means element[1] to element[2]
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

Question 231 pts
Select the appropriate output after running the following code block:
my_list=['p','r','o','b','e']
print(my_list[0])
Group of answer choices
r
b
p
e
Flag this Question
Question 241 pts
Describe the action being executed by the former code block:
HTML EditorKeyboard Shortcuts
p is at 0th location.
Question 251 pts
Select the appropriate output after running the following code block:
my_list=['p','r','o','b','e']
print(my_list[2])
Group of answer choices
o
p
0
e
Question 261 pts
Describe the action being executed by the former code block:
Select the appropriate output after running the following code block:
my_list=['p','r','o','b','e']
print(my_list[0])
Group of answer choices
r
b
p
e
Flag this Question
Question 241 pts
Describe the action being executed by the former code block:
HTML EditorKeyboard Shortcuts
p is at 0th location.
Question 251 pts
Select the appropriate output after running the following code block:
my_list=['p','r','o','b','e']
print(my_list[2])
Group of answer choices
o
p
0
e
Question 261 pts
Describe the action being executed by the former code block:
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

o is at my_list[2]
Question 271 pts
Select the appropriate output after running the following code block:
n_list=["Happy",[2,0,1,5]]
print(n_list[0][1])
Group of answer choices
p
a
2
0
Flag this Question
Question 281 pts
Describe the action being executed by the former code block:
HTML EditorKeyboard Shortcuts
“Happy” is at 0th location and ‘a’ is at 1st loc.
Flag this Question
Question 291 pts
Select the appropriate output after running the following code block:
n_list=["Happy",[2,0,1,5]]
print(n_list[1][3])
Group of answer choices
y
p
5
Question 271 pts
Select the appropriate output after running the following code block:
n_list=["Happy",[2,0,1,5]]
print(n_list[0][1])
Group of answer choices
p
a
2
0
Flag this Question
Question 281 pts
Describe the action being executed by the former code block:
HTML EditorKeyboard Shortcuts
“Happy” is at 0th location and ‘a’ is at 1st loc.
Flag this Question
Question 291 pts
Select the appropriate output after running the following code block:
n_list=["Happy",[2,0,1,5]]
print(n_list[1][3])
Group of answer choices
y
p
5

0
Flag this Question
Question 301 pts
Describe the action being executed by the former code block:
HTML EditorKeyboard Shortcuts
“2,0,1,5” is at 1st loc and 5 is at 3rd loc
Flag this Question
Question 311 pts
Select the appropriate output after running the following code block:
aTuple=('ready','fire','aim')
aList=list(aTuple)
print("Length of the list:",len(aList))
Group of answer choices
Length of the list: 20
Length of the list: 12
Length of the list: 3
Length of the list: 0
Flag this Question
Question 321 pts
Describe the action being executed by the former code block:
HTML EditorKeyboard Shortcuts
The list contains 3 elements only.
Flag this Question
Flag this Question
Question 301 pts
Describe the action being executed by the former code block:
HTML EditorKeyboard Shortcuts
“2,0,1,5” is at 1st loc and 5 is at 3rd loc
Flag this Question
Question 311 pts
Select the appropriate output after running the following code block:
aTuple=('ready','fire','aim')
aList=list(aTuple)
print("Length of the list:",len(aList))
Group of answer choices
Length of the list: 20
Length of the list: 12
Length of the list: 3
Length of the list: 0
Flag this Question
Question 321 pts
Describe the action being executed by the former code block:
HTML EditorKeyboard Shortcuts
The list contains 3 elements only.
Flag this Question
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

Question 331 pts
Select the appropriate output after running the following code block:
aTuple=('ready','fire','aim')
aList=list(aTuple)
list_element1=aList[0]
print(list_element1)
Group of answer choices
None of these
ready
fire
aim
Flag this Question
Question 341 pts
Describe the action being executed by the former code block:
HTML EditorKeyboard Shortcuts
The 0th element is ready
Flag this Question
Question 351 pts
Select the appropriate output after running the following code block:
aTuple=('ready','fire','aim')
aList=list(aTuple)
list_element3=aList[2]
print(list_element3)
Group of answer choices
fire
Select the appropriate output after running the following code block:
aTuple=('ready','fire','aim')
aList=list(aTuple)
list_element1=aList[0]
print(list_element1)
Group of answer choices
None of these
ready
fire
aim
Flag this Question
Question 341 pts
Describe the action being executed by the former code block:
HTML EditorKeyboard Shortcuts
The 0th element is ready
Flag this Question
Question 351 pts
Select the appropriate output after running the following code block:
aTuple=('ready','fire','aim')
aList=list(aTuple)
list_element3=aList[2]
print(list_element3)
Group of answer choices
fire
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

None of these
ready
aim
Flag this Question
Question 361 pts
Describe the action being executed by the former code block:
HTML EditorKeyboard Shortcuts
The list[2] = ‘aim’
Flag this Question
Question 371 pts
Select the appropriate output after running the following code block:
languages=["Python","C","C++","Java","Perl"]
print(languages[0]+" and "+languages[1]+" are quite different !")
Group of answer choices
Java and C are quite different !
C++ and C are quite different !
Python and C are quite different !
C and Python are quite different !
Flag this Question
Question 381 pts
Describe the action being executed by the former code block:
HTML EditorKeyboard Shortcuts
0th and 1th location are “python” and “c”
ready
aim
Flag this Question
Question 361 pts
Describe the action being executed by the former code block:
HTML EditorKeyboard Shortcuts
The list[2] = ‘aim’
Flag this Question
Question 371 pts
Select the appropriate output after running the following code block:
languages=["Python","C","C++","Java","Perl"]
print(languages[0]+" and "+languages[1]+" are quite different !")
Group of answer choices
Java and C are quite different !
C++ and C are quite different !
Python and C are quite different !
C and Python are quite different !
Flag this Question
Question 381 pts
Describe the action being executed by the former code block:
HTML EditorKeyboard Shortcuts
0th and 1th location are “python” and “c”

Flag this Question
Question 391 pts
Select the appropriate output after running the following code block:
my_list=['p','r','o','g','r','a','m','i','z']
print(my_list[2:5])
Group of answer choices
['r', 'o', 'g', 'r']
[ 'r', 'o', 'g']
['o', 'g', 'r']
['p', 'r', 'o', 'g']
Flag this Question
Question 401 pts
Describe the action being executed by the former code block:
HTML EditorKeyboard Shortcuts
my_list[2:5] means my_list[2] to my_list[4]
Flag this Question
Question 411 pts
Select the appropriate output after running the following code block:
my_list=['p','r','o','g','r','a','m','i','z']
print(my_list[:-5])
Group of answer choices
['r', 'a', 'm', 'i', 'z']
['p', 'r', 'o', 'g', 'r']
Question 391 pts
Select the appropriate output after running the following code block:
my_list=['p','r','o','g','r','a','m','i','z']
print(my_list[2:5])
Group of answer choices
['r', 'o', 'g', 'r']
[ 'r', 'o', 'g']
['o', 'g', 'r']
['p', 'r', 'o', 'g']
Flag this Question
Question 401 pts
Describe the action being executed by the former code block:
HTML EditorKeyboard Shortcuts
my_list[2:5] means my_list[2] to my_list[4]
Flag this Question
Question 411 pts
Select the appropriate output after running the following code block:
my_list=['p','r','o','g','r','a','m','i','z']
print(my_list[:-5])
Group of answer choices
['r', 'a', 'm', 'i', 'z']
['p', 'r', 'o', 'g', 'r']
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide
1 out of 36

Your All-in-One AI-Powered Toolkit for Academic Success.
+13062052269
info@desklib.com
Available 24*7 on WhatsApp / Email
Unlock your academic potential
Copyright © 2020–2025 A2Z Services. All Rights Reserved. Developed and managed by ZUCOL.