Which of the following is NOT an accurate data type in Python?
A) String (Str)
B) Integer (Int)
C) Float (float)
D) Steam (Ste)
D) Steam (Ste)
n = 3**2
if (n%2==1) and (n==6):
print("A")
else:
print("B")
What is the result of the code?
B
_______ defines a function.
1) f(x)
2) f
3)def
4)defi
3)def
while(number<3):
print("Hello")
number+=1
Hello
Hello
print(2323%5353)
2323
Which keyword is used to define a function in Python?
A) def
B) fun
C) function
D) define
A) def
num = 0
for i in range(1,5):
num+=i
print(num)
What is the result for printing the code?
10
What will be printed out in this equation? print (7%3)
1
while(num>20):
num*=3
print(num)
print(num)
13
print(not True)
False
What is Python?
A)C++library
B)Web browser
C) IDE (Integrated Developer Environment)
D) Programming language
D) Programming language
What would be the result of this code?
x = input(Type a number)
y = x + 5
print(y)
Error
names = ["Justin", "Anna", "Max", "Martin", "Susan"]
for name in names:
if len(name)>5:
print(name)
What would the code print?
Justin
Martin
c=1
while c<10:
if c%2 == 0:
print(c)
c+=3
4
How many different outputs are possible:
import random
a = random.randint(1,5)
print(a)
5
What will be the value of the following Python expression?
4+3%5
For a while loop to be exited, what statement should be used?
the "break" statement
When do we use float()?
Letter
Numbers with decimal
Integers
True/False
2. Numbers with decimal
while len(message) < 10:
message = message + message
print(len(message))
(Hint: len function will give the length of the String)
12
num = len("????")
while num<20:
if num<10:
num*=2
else:
num+=7
print(num%20)
3
Which of the following is invalid variable?
A) my_string_1
B) 1st_string
C) foo
D) _
B) 1st_string
b=3
if b%2 == 1:
print("Condition 1 Satisfied")
if b%2 != 3:
print("Condition 2 Satisfied")
Condition 1 Satisfied
Condition 2 Satisfied
What will be the answer of the following code? print(2**3 + (5 + 6)**(1 + 1))
129
a = (39482**19)%7
b = a
if b > 10:
a*=0
elif b>20:
a+=7
print(a==b)
True
The variable value is an integer. What will the following code print out?

4