Home
Explore
Exams
Login
Get started
Home
Engineering
Computer Science
LV - Python
5.0
(2)
Rate it
Studied by 8 people
5.0
(2)
Rate it
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
Special Senses
Updated 355d ago
Note
Preview
Unit 1 Biology Test
Updated 1241d ago
Note
Preview
Geography: The Sea
Updated 1100d ago
Note
Preview
Reforming the National Government and The 1787 Constitutional Convention
Updated 1219d ago
Note
Preview
Jeopardy: Genetics Review
Updated 343d ago
Note
Preview
INTEGRATED BODY
Updated 1104d ago
Note
Preview
WORLD HISTORY
Updated 1353d ago
Note
Preview
Chapter 9: Global Change
Updated 94d ago
Note
Preview
Special Senses
Updated 355d ago
Note
Preview
Unit 1 Biology Test
Updated 1241d ago
Note
Preview
Geography: The Sea
Updated 1100d ago
Note
Preview
Reforming the National Government and The 1787 Constitutional Convention
Updated 1219d ago
Note
Preview
Jeopardy: Genetics Review
Updated 343d ago
Note
Preview
INTEGRATED BODY
Updated 1104d ago
Note
Preview
WORLD HISTORY
Updated 1353d ago
Note
Preview
Chapter 9: Global Change
Updated 94d ago
Note
Preview
Explore top flashcards
IB Spanish vocab
Updated 254d ago
Flashcards (163)
Preview
IT 002- INTRO TO MEDIA INFORMATION LITERACY
Updated 679d ago
Flashcards (35)
Preview
BIO 3524 Mi-session 2
Updated 820d ago
Flashcards (98)
Preview
Muscles lab with origins and insertions
Updated 705d ago
Flashcards (72)
Preview
HHD CH1 Health & wellbeing
Updated 1088d ago
Flashcards (44)
Preview
7th Grade, Chapter 3 "Transition in Sub-Saharan Africa"
Updated 1186d ago
Flashcards (20)
Preview
Taxonomy and biodiversity classification study guide
Updated 119d ago
Flashcards (35)
Preview
Introduction to Astronomy Test 1
Updated 1066d ago
Flashcards (67)
Preview
IB Spanish vocab
Updated 254d ago
Flashcards (163)
Preview
IT 002- INTRO TO MEDIA INFORMATION LITERACY
Updated 679d ago
Flashcards (35)
Preview
BIO 3524 Mi-session 2
Updated 820d ago
Flashcards (98)
Preview
Muscles lab with origins and insertions
Updated 705d ago
Flashcards (72)
Preview
HHD CH1 Health & wellbeing
Updated 1088d ago
Flashcards (44)
Preview
7th Grade, Chapter 3 "Transition in Sub-Saharan Africa"
Updated 1186d ago
Flashcards (20)
Preview
Taxonomy and biodiversity classification study guide
Updated 119d ago
Flashcards (35)
Preview
Introduction to Astronomy Test 1
Updated 1066d ago
Flashcards (67)
Preview