Home
Explore
Exams
Login
Get started
Home
Engineering
Computer Science
LV - Python
5.0
(2)
Rate it
Studied by 9 people
View linked note
Call Kai
Learn
Practice Test
Spaced Repetition
Match
Flashcards
Knowt Play
Card Sorting
1/19
Earn XP
Description and Tags
Computer Science
All Modes
Learn
Practice Test
Matching
Spaced Repetition
Call with Kai
Last updated 10:48 AM on 5/15/23
Update
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
No analytics yet
Send a link to your students to track their progress
20 Terms
View all (20)
Star these 20
1
New cards
indexing
making and printing the list:
listFood = \[“chocolate”, “cheese”, “fruit”\]
print(listFood\[1\])
2
New cards
slicing (start, stop, step)
start stop step refers to the positions
\[start:stop:step\]
start = the index number the index begins
stop = the index number the index ends
step = the jump range
3
New cards
append()
to add an item to the end of a list:
listNames.append(“sally”)
4
New cards
insert()
to insert an item into a specific place on the list:
listNames.insert(2, “elisa”)
5
New cards
remove()
to remove an item from a list:
listNames.remove(“penelope”)
6
New cards
pop()
takes out an item at a certain index in a list:
listNames.pop(3)
7
New cards
del list\[\]
deletes permanently the item at a particular index:
del listNames\[4\]
8
New cards
sort()
sorts a list into ascending order:
listNames.sort()
9
New cards
len()
prints out the number of terms in a list:
print(len(listNames))
10
New cards
index()
returns the number where the item appears in the list:
print(listNames.index(“freya”))
11
New cards
using “in”
“in” is used to say if something is in the list then something else should happen:
if “elsa” in listNames:
12
New cards
validation - range
user is asked to input something between a certain range:
numRange = int(input(“Please enter a number between 11 and 18”))
13
New cards
validation - lookup
user is asked to input something from a store of data:
country = input(“Please enter a country from the list above”)
14
New cards
“==”
to compare terms:
if item == “a”:
15
New cards
nested for loops
a loop inside a loop:
x = \[1, 2\]
y = \[4, 5\]
\
for i in x:
for j in y:
print(i, j)
16
New cards
when do you use a nested loop?
if you have multiple lists that you want to do something with, or if you have a list within a list (a nested list)
17
New cards
def functionName():
the way of naming a function:
def addTwoNumbers():
print(2+2)
18
New cards
Formal parameters
items in brackets which are variables:
def addTwoGivenNumbers(num1 + num2):
print(num1+num2)
19
New cards
Actual parameters
items in brackets which are actual things:
addTwoNumbers(6+7):
print(6+7)
20
New cards
return functions
instead of printing, it is returning something:
def returnAdditionOfTwoNumbers(num1+num2):
return num1+num2
Explore top notes
Chapter 3- Separation and Purification
Updated 1260d ago
0.0
(0)
Avoiding Redundancy
Updated 1170d ago
0.0
(0)
Chapter 13: Question Marks
Updated 997d ago
0.0
(0)
Ultimate AP Seminar Study Guide
Updated 87d ago
0.0
(0)
Physical Science - Chapter 3
Updated 1005d ago
0.0
(0)
How Writers Develop Arguments, Intros, and Conclusions
Updated 337d ago
0.0
(0)
Chapter 1 - The Birth of Civilization
Updated 1263d ago
0.0
(0)
🧠 AP Psychology Ultimate Guide
Updated 120d ago
0.0
(0)
Chapter 3- Separation and Purification
Updated 1260d ago
0.0
(0)
Avoiding Redundancy
Updated 1170d ago
0.0
(0)
Chapter 13: Question Marks
Updated 997d ago
0.0
(0)
Ultimate AP Seminar Study Guide
Updated 87d ago
0.0
(0)
Physical Science - Chapter 3
Updated 1005d ago
0.0
(0)
How Writers Develop Arguments, Intros, and Conclusions
Updated 337d ago
0.0
(0)
Chapter 1 - The Birth of Civilization
Updated 1263d ago
0.0
(0)
🧠 AP Psychology Ultimate Guide
Updated 120d ago
0.0
(0)
Explore top flashcards
Vocab From Latin And Greek Roots Unit 7 & 8
33
Updated 482d ago
0.0
(0)
Ancient Greece WH1 Study Set
49
Updated 1192d ago
0.0
(0)
Thermodynamics and Fluid Mechanics (AE-280) Final
88
Updated 689d ago
0.0
(0)
E2a - Family Members & Pets
33
Updated 421d ago
0.0
(0)
Drug Quiz 4- Class and Indication
36
Updated 826d ago
0.0
(0)
AP United States History Ultimate Review Guide Flashcards
376
Updated 65d ago
0.0
(0)
DÉFI 5 – Jong zijn, onafhankelijk zijn? (copy)
42
Updated 1082d ago
0.0
(0)
Unit 3 Vocabulary
29
Updated 899d ago
0.0
(0)
Vocab From Latin And Greek Roots Unit 7 & 8
33
Updated 482d ago
0.0
(0)
Ancient Greece WH1 Study Set
49
Updated 1192d ago
0.0
(0)
Thermodynamics and Fluid Mechanics (AE-280) Final
88
Updated 689d ago
0.0
(0)
E2a - Family Members & Pets
33
Updated 421d ago
0.0
(0)
Drug Quiz 4- Class and Indication
36
Updated 826d ago
0.0
(0)
AP United States History Ultimate Review Guide Flashcards
376
Updated 65d ago
0.0
(0)
DÉFI 5 – Jong zijn, onafhankelijk zijn? (copy)
42
Updated 1082d ago
0.0
(0)
Unit 3 Vocabulary
29
Updated 899d ago
0.0
(0)