CP104 Study Guide - Final Guide: Butterscotch

146 views3 pages
School
Course
Professor
Final Exam practice
Question 1(zero_init)
def zero_init(wholelist):
for i in range (len(wholelist)):
for c in range(len(wholelist[0])):
wholelist[i].pop(c)
wholelist[i].insert(c,0)
return wholelist
#main program
rows=int(input('enter the number of rows'))
cols=int(input('enter the number of columns'))
wholelist=[ ]
for i in range (rows):
sublist=[ ]
for c in range (cols):
items=input('enter an element')
sublist.append(items)
wholelist.append(sublist)
print(wholelist)
Unlock document

This preview shows page 1 of the document.
Unlock all 3 pages and 3 million more documents.

Already have an account? Log in
hayjayshay and 38575 others unlocked
CP104 Full Course Notes
2
CP104 Full Course Notes
Verified Note
2 documents

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers

Related Documents

Related Questions