Font size
WorksheetsPython
Total questions: 17
Worksheet time: 34mins
What will this python code do?
print("Hello, World")
Display Hello, World
Sent a message to our printer to print Hello, World in a paper
Display "Hello, World"
Nothing its syntax is wrong
how do we assign to the variable x a value of 5?
var x = 5;
var x = 5
x = 5
(x) == 5
Whats wrong with the script below?
print(a+b)
a = 5
b = 10
The program doesn' t now what a and b is.
The print function should be print("a+b")
The print function should be print(a + b)
click the correct if function:
if x = 5:
if x = num(5):
if x == 5:
if x = float(num(5)):
Whats the correct boolean type:
x == 5
x = 5
x = condition(True)
x = True
x == True
why will the following script won't work?
user_input1 = input("Enter a number: ")
user_input2 = input("Enter a second number: ")
print(user_input1 + user_input2)
Because variables cannot be longer than 1 word
Because user_input1 and user_input2 is a string
Because input is an invalid function
Because python will always thing that it has to add 1+2
It will work
Click all the functions that exist in python:
elif
function
if
float()
key_input
Which of the following is a GUI extension for python (Graphical User Interface)
extension.py.gui
Python.gui
tkinter
root
what is the following:
x = [3, 5, 7, 10, 9]
A boolean
A tuple
A list
A string
How many times will the following code execute:
i = 0
while i <= 10:
print(i)
i += i
Infinity
None because <= isnt valid
10
9
When we get an input what type of variable is it?Examble:
input_var = input("Input: ")
float
string
int
key
In the below function how is the the thing inside the brackets called:
def handle_turn(current_turn):
Parameter
Condition
Info
Def info
String
in:
import random
whats random?
function
module
External_function
External_module
I.E (Importable Element)
Which of the following is correc tif x is a boolean and we want to check if x is equal to True.
if x == "True":
if x == True:
if x:
if x = True:
What will the below line of code print?
print(3**2)
9
12
10
5
Which code will work?
1) num1 = input("Number 1")
num2 = input("Number 2")
print(num1+num2)
2)num1 = float(input("Number1")
num2= float(input("Number 2")
print(num1+num2)
1
2
What will the code below print if num1 = 5 and num2 = 8?
num1 = input("Number 1")
num2 = input("Number 2")
print(num1+num2)
85
58
5+8
None of the above
