python basics Flashcards
(33 cards)
in print what is the + used for
to join two strings
in print what is a , used for
to join a string and a int
what would the output of this line of code print(“test”,”test”)
test test , give a space
the to parts of this line are called what print(“test”)
funtion and peramitor
what is the \ used for
escaped charictor turns the next charictor into a aski eg cancels its funtion
what are the two ways of fixing the \ in file paths
replace all \ with \ or /
what are the three basic maths symbols
+ - * /
what is the turm used in programing for decimal numbers
float
what is used as the formula for the power of
**
what is the syntax for creating a var
var = 100
can you put a funtion in a variable
yes
can you write out a funtion in a varible
var = othervar / 5.3
explain while loop in a sentence
while something is the case do something
write down the start of a while loop
var = 10
while var <10:
how do you end the first line of a while loop
:
what does this code do conditon += 1 do
adds one to the variable
what does += do
adds one to a varible
what is another way to write var = var + 1
var += 1
what is the simbol for a single line comment
#
how do you comment multiple lines at once
’’’
write a quick while loop
example
var
while var <10:
var += 1
how do you stop a script running
ctl + c
what is a simpol way to make a infinite loop using while
while True:
print(“ahhh”)
write out a basic list
list = []