NEW
Font size
WorksheetsPython Fun for Young Learners
Total questions: 10
Worksheet time: 5mins
What is the correct way to create a variable in Python?
10 = x
x = 10
let x = 10
x : 10
Which of the following is a valid data type in Python?
boolean
float
string
int
What will the output of print(2 + 3) be?
4
7
5
6
How do you start a for loop in Python?
foreach variable in iterable:
for variable in iterable:
for each variable in iterable:
for (variable in iterable) {
What keyword is used to define a function in Python?
function
define
def
method
How can you get user input in Python?
Use the 'read()' function to get user input.
Use the 'scan()' function to get user input.
Use the 'get()' function to get user input.
Use the 'input()' function to get user input.
What will the output of print('Hello' * 3) be?
HelloHelloHello
Hello 3 times
HelloHello
HelloHello!
Which symbol is used for comments in Python?
;
#
//
What is the purpose of the return statement in a function?
To print output to the console.
To create a loop within a function.
The purpose of the return statement is to exit a function and return a value to the caller.
To define a function's parameters.
How do you read a file in Python?
Read a file by calling 'file.read(filename)' directly.
Use 'with open(filename, 'w') as file: content = file.read()' to read a file in Python.
Use 'with open(filename, 'r') as file: content = file.read()' to read a file in Python.
Use 'open(filename) as file: content = file.read()' to read a file in Python.
