Font size
WorksheetsPython_3P_Basics
Total questions: 31
Worksheet time: 18mins
How many variables are there in this program?
2
3
4
5
What would be the output of this program if the user input was 10?
22.04
220.4
2204
Error wrong data type
What would be the output of this program if the user entered "yes" then "what"?
Enjoy your day
it is too windy for an umbrella
Take an umbrella
Error
What data type represents a decimal number?
Float
Int
Boolean
String
Which of these is the correct code for creating a list of names?
nameList = John, Harry, Jesse, John, Harry, Harry
nameList = ("John", "Harry", "Jesse", "John", "Harry", "Harry")
nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]
nameList = [John, Harry, Jesse, John, Harry, Harry]
List items have an index number. In the following list, which item has the index number of 3?
["John", "Harry", "Jesse", "John", "Harry", "Harry"]
"John"
"Harry"
"Jesse"
Which of these pieces of code would return the name "Harry" from the following list?
nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]
nameList()
nameList[1]
NameList(4)
nameList["4"]
The list needs one more name added to the end - "Felipe". Which piece of code below would do this?
nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]
nameList.append(Felipe)
append(nameList,"Felipe")
nameList.append["Felipe",7]
nameList.append("Felipe")
Output of this code?
[2,4,6,8,10]
['2','4','6','8','10']
[0,2,4,6,8]
[10,8,6,4,2]
What would the output of the program be?
thisList = ["square", "circle", "triangle", "octagon"]
if "triangle" in thisList:
print("Yes, 'triangle' is in the list")
else:
print("No triangle here!")
Yes, 'triangle' is in the list
"No triangle here!"
What does the following code output?
11, 9
16, 16
None, None
225, 117
What will be displayed?
Nothing
5, 6, 7, 8, 9
1, 2, 3, 4, 5
1, 1, 1, 1, 1
5, 6, 7, 8, 9, 10
What is the error in this code?
incorrect variable name
incorrect indentation
incorrect speech marks
incorrect loop
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
What is the output?
next
stop
next
stop
syntax error - program doesn't work
What will the output be for the code shown here?
3,2,1,0
0,1,2,3
3,2,1
1,2,3
¿Cuál de las siguientes opciones sería el contenido de una variable de tipo String?
Hola
P
"Soy una variable"
18.9
Forma correcta para declarar la condición if
if a<18;
if a<18:
if a<18 {
Se pueden escribir tantos bloques elif como sean necesarios.
Falso
Verdadero
¿Cuál es el resultado esperado al ejecutar el siguiente programa?
¿Cuál es la forma correcta de escribir un ciclo while en Python?
A) while i < 10:
B) for i in range(10):
C) do while i < 10:
D) repeat until i < 10:
Valor de la siguiente operación: 5 + 8 + 3
15
15.0
16
16.0
Error
¿Cuál de las siguientes opciones es una variable de tipo Float?
-7.12
5
'8.2'
10.4
Complete el comando de python en el siguiente programa
elseif
elif
else
else if
¿Cual de las siguientes opciones es correcta?
¿Con qué palabra se especifica el valor que queremos que la función nos devuelva?
return
result
def
back
¿Cuál es la palabra correcta para definir funciones en Python?
function
func
def
define
