TEST Flashcards
\n digraph forces the print() function
Breaks the output line.
Meaning of the keyword parameter
The argument’s name specified along with its value
The value twenty point twelve times ten raised to the power of eight should be written as?
20.12E8
The 0O prefix means that the number after it is denoted as.
Octal
The ** operator
Performs exponentiation
The result of the following division: 1/1
1.0 because the any time you use the divide by symbol it returns a floating point number.
If you wanted to return 1
you would use 1 // 1
The result of the / operator is always an integer value
false
the result of the following expression:
1 // 2 * 3
zero -
floor division // ***
Left sided binding
variable names are illegal
True
The print() function can output values of
any number of arguments
(including zero)
Output of the following snippet
x=1
y=2
z=x (1)
x=y (2)
y=z (1)
print(x,y)
2 1
What is the output of the following snippet if the user enters two lines containing 2 and 4
x=input() 2
y=input() 4
print(x+y)
input always inputs string so it would need int if it wanted to be converted to integer so the output is.
24
What is the output of the following snippet if the user enters the two lines 2 and 4
x=int(input) 2
y=int(input) 4
x=x//y 0 2 floor division 4
y=y//x 4 / 0
print(y)
code will cause a runtime error
What is the output of the following snippent if user enters 2 and 4?
x=int(input()) .5
y=int(input()) 4
x=x/y
y=y/x
print(y)
8.0
What is the output of the following snippet if the user enters two lines containing 11 and 4.
x=int(input())
y=int(input())
x = x % y 3
x = x % y 3 3 mod 4 is still 3
y = y % x 4 mod 3 == 1
print(y)
1
What is the output of the following snippet if the user enters two lines containing 3 and 6.
x=input() string 3
y=int(input() 6
print(x*y)
outputs 333333
What is the output of the following snippet
z = y = x = 1
print(x,y,z,sep=’*’)
111
Output of the following snippet
x = 2 + 3 * 5.
print(X)
17.0
***Causes execution error because the variable X is never created.
What is the output of the following snippet
x = 1 / 2 + 3 // 3 + 4 ** 2
print(x)
4 ** 2 = 16
3 floor division 3 == 1 17
1 / 2 = .5
17.5
What is the output of the following snippet if the user enters two lines containing 2 and 4
x=int(input()) 2 y=int(input()) 4 print(x+y) 6
6
An operator able to check whether two values are equal is
’==’
The value eventually assigned to x is equal to:
x = 1
x = x == x
True
How many stars will the following snippet send to the console.
i = 0
while i <= 3 :
i += 2
print(“*”)
2 stars are output