Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Basics - Hello World!

Total questions: 9

Worksheet time: 6mins

Name
Class
Date
1.

Which of the following is the correct extension of the Python file?

a)

a) .python

b)

b) .pl

c)

c) .py

d)

d) .p

2.

Which of the following character is used to give single-line comments in Python?

a)

a) //

b)

b) #

c)

c) !

d)

d) /*

3.

What would be printed by the command

print('12-5')

a)

12-5

b)

'12-5'

c)

7

d)

'7'

4.
What will the output be from the following code?
print(Hello world!)
a)
Hello world!
b)
SyntaxError
c)
Hello world
d)
print(Hello world!)
5.

What will be the output of the following statement?

type('5')

a)

str

b)

int

c)

float

d)

Boolean

6.

Which of the following is a data type in Python? Select multiple answers.

a)

int

b)

words

c)

string

d)

decimals

7.

What is a correct syntax to output "Hello World" in Python?

a)

echo("Hello World")

b)

echo "Hello World"

c)

print("Hello World")

d)

PRINT("Hello World")

8.

How do you insert COMMENTS in Python code?

a)

/*this is a comment

b)

//this is a comment

c)

#this is a comment

9.

In Python, 'Hello', is the same as "Hello"

a)

yes

b)

no