Basic Python Programming Test | Boffins Academy
1) Write a program whether a number is divisible by 7 and 9.
2) Write a program to check whether a number is Positive or Negative.
3) How many data types in Python programming?
4) What is the data type of this program?
x = 75.4
print(type(x))
5) What is the data type of this program?
x = ("apple", "banana", "cherry", "kiwi", "tomato")
print(type(x))
6) What is the data type of this program?
x = {"name": "Rakesh", "age": 36}
print(type(x))
7) What is the data type of this program?
x = True
print(type(x))
8) Create a variable named "Age" and assign the value "35" to it.
9) Write a program for the sum of 25 + 15, using two variables: x and y.
10) What do you write in blank space so the number would be in Float data type?
x = 5
x = "_____" (x)
11) The statement below would print a Boolean value, what do you think it is "yes" or "no"?
Print (10 == 9)
12) Write a python program to divide 22 by 2.
13) Use the correct comparison operator to check if 5 is not equal to 10. Write in blank space.
if 5 "___" 10:
print ("5 and 10 is not equal")
14) Print "Hello World" if a is greater than b. Write in blank space.
a = 80
b = 35
"__" a "__" b:
Print ("Hello World")
15) Print "Hello World" if a is not equal to b.
a = 50
b = 10
"__" a "__" b:
Print ("Hello World")
16) Print "Yes" if a is equal to b, otherwise print "No".
a = 50
b = 10
if a "__" b:
print("Yes")
"__":
print("No")
17) Print "Science" if a is equal to b, and c is equal to d.
if a == b "__" c == d:
print("Science")
18) Print "Boffins" if a is equal to b, or if c is equal to d.
if a == b "__" c == d:
print ("______")
19) Stop the loop if i is 3.
i = 1
while i < 6:
if i == 3:
"____"
i += 1
20) Use the range function to loop through a code set 6 times.
for x in "____":
print(x)
21) How many types of Operators in Python?
22) Draw a pattern.
1 1 2 1 2 3 1 2 3 4 1 2 3 4 5
23)
1 1 1 1 1 2 2 2 2 3 3 3 4 4 5
24)
0 1 2 3 4 5 0 1 2 3 4 0 1 2 3 0 1 2 0 1
25)
1 3 3 5 5 5 7 7 7 7 9 9 9 9 9
26)
5 5 5 5 5 4 4 4 4 3 3 3 2 2 1
27)
1 2 1 3 2 1 4 3 2 1 5 4 3 2 1