WorksheetsPython Basics
Total questions: 25
Worksheet time: 12mins
What is the Return type of input() function?
Int
float
String
List
1
2
3
4
1
4
10
11
Is python an interpreter or compiler programming language?
Compiler
Interpreter
What will be the output?
name = "Dave"
print (name)
Dave
'Dave'
name
(name)
Evaluate the following expression:
"dog" < "Dog"
They are the same word
True
False
For strings, the + operator represents
Concatenation
Addition
Appending
Recantation
What will this code do?
Print Numbers 1-11
Print Numbers 1-10
Print Numbers 2-10
Print Error
What sort of loop is this?
Count Controlled
Condition Controlled
What will this code print?
Print the word 'letter'.
Print a user input on one line.
Print a user input one letter at a time.
Print an Error.
Which of these is NOT a loop in python?
for loop
while loop
nested loop
if loop
Which of these operators means EQUAL TO?
'='
'=>'
'<='
'=='
What will be the output of this code?
1,2,3,4,5,6,7,8,9,10,11,12
0,2,4,6,8,10
2,4,6,8,10,12
2,4,6,8,10
Each item in a string has an "address" or index. The first index in a Python string is what?
0
1
a
A
Returning a range of characters (part of a string) is done using which syntax?
Slice
Splice
Cut
Select
What is the output from this code?
ell
llo
ello,
Hello
What is the output from this code?
, W
Wor
orl
lro
Look at the following code, what will it generate
1,2,3,4,5,6,7,8,9,10,11,12
0,1,2,3,4,5,6,7,8,9,10,11,12
1,2,3,4,5,6,7,8,9,10,11,12,13
0,1,2,3,4,5,6,7,8,9,10,11,12,13
What does the following program display?
1,2,3,4
1,2,3,4,5
counter,counter,counter,counter,counter
0,1,2,3,4,5
When do you know when you come to the end of the loop?
Its states End loop
The command End is given
The indentation stops
if you wished a loop to repeat 3 types whwt should you use?
For counter in range(0,5):
For counter in range(1.3):
For counter in range(0.3):
