quiz Flashcards
(12 cards)
whats output of: type(“5”)
str
whats output of (“Moon\n Light”)
Moon
Light
what is % used for
modulo, so 10%3 = 1, bcuz 10/3 leaves a REMAINDER of 1
what is // used for
discards the remainder, so 7//2 = 3
what is # used for
thats for a comment
whats the output of “2” + “2”
“22”, cuz it puts both strings together
whats the output of the following code:
y = 0
print (f’ They have {y} interest in my story!’)
They have 0 interest in my story!
whats the output of this:
x=2
y=3
y= x
x=0
y
answer is 2, always go back to the top
whats the output of this
for i in range (3):
s = 2
s = s + i
print (s)
answer is 4, ohh cuz when its a for loop, so when the loop is done (starts with 0, then 1, then 2 cuz range of 3), when its done the last value of i is 2, soooo i = 2
whats the output of this code
for i in range (1,4,4):
print (i)
a
1
2
3
b
1
4
4
c
1
3
d
1
d! = 1
wats the output of
def g(x):
print (2*x)
g(4)
8
whats output of
2*2//3+1
2