Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Exam (elaborations)

Purdue CNIT 155 Final Exam (Python) ACTUAL QUESTIONS AND CORRECT ANSWERS

Rating
-
Sold
-
Pages
13
Grade
A+
Uploaded on
24-10-2025
Written in
2025/2026

Purdue CNIT 155 Final Exam (Python) ACTUAL QUESTIONS AND CORRECT ANSWERS What is a List? - Correct answers A data structure that can store many values of under one name Which is an example of how to create an empty list? - Correct answers Variable = [] Variable = list() Which is an example of how to create a list with predefined values? - Correct answers colors = ["red, "yellow", "blue"] To create a list with predefined values, you have to.... - Correct answers Put a sequence of

Show more Read less
Institution
Course

Content preview

CNIT 155 FInal (Purdue) ACTUAL
QUESTIONS AND CORRECT ANSWERS
Two Ways to Create an Empty List: - Correct answers✔✔list1 = [ ]

list1 = list ()



How to Create a List? - Correct answers✔✔Put a sequence of items in [ ]



Ex. colors = ["red", "yellow", "blue"]



Reading 10 Values from a User then Finding the Minimum - Correct answers✔✔values = [ ]

for i in range (0, 10):

v1 = int(input("Enter a value"));

values.append(v1);



print(values)

print(min(values))



Three Methods of Adding Elements to a List - Correct answers✔✔list1.append(elem)

(adds a single element to the end of the list)



list1.insert(index,elem)

(inserts the elem at the given index, shifting elements to the right)



list1.extend(list2)

, (adds the elements in list2 to the end of the list)



Access an Individual Element in a List Using an Index - Correct answers✔✔list1[index]



Positive Indexes - Correct answers✔✔- First element in the list has index 0

- Second element has index 1

-n'th element is n-1



Negative Indexes - Correct answers✔✔- Index -1 identifies the last element

- -2 identifies the next to last element, etc.



Built-In List Functions in Python - Correct answers✔✔function - description

len - returns the number of items in the list

min - returns the min among the elements in the list

max - returns the max among the elements in the list

sum - returns the sum of all elements in the list



Shuffle Function - Correct answers✔✔from random import shuffle

shuffle(list1)



How to Call Methods Provided by a List - Correct answers✔✔list.methodName(arguments)



Traversing a List - Correct answers✔✔for index in range (len(scores)):

print (index, "\t" , grade[i])

Written for

Course

Document information

Uploaded on
October 24, 2025
Number of pages
13
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

$11.99
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
GENIOUSTOPCLASS
3.0
(1)

Get to know the seller

Seller avatar
GENIOUSTOPCLASS Stanford
Follow You need to be logged in order to follow users or courses
Sold
1
Member since
10 months
Number of followers
0
Documents
1857
Last sold
7 months ago
ACADEMIC EXAMS PLATFORM

I create high-quality, easy-to-understand academic documents to help students learn faster and perform better. My materials are well-researched, clearly organized, and cover key exam topics to make studying simple and effective.

3.0

1 reviews

5
0
4
0
3
1
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions