Font size
WorksheetsCOMPUTER 10 - ACTIVITY 5 - 2023-2024
Total questions: 35
Worksheet time: 25mins
To add a new element to a list we use which Python command?
x.append(5)
print([i])
(list1)
range(5)
In Python, (a) is used to request and get information from the user
What is the Python built-in function used to display numbers and text on the screen?
input
output
command
It displays an output
Which of the following programs prints ten lines?
for i in range(10):
print("hi")
for i = 1 to 10:
print("hi")
for i in 1 - 10:
print("hi")
for i from 0 to 9:
print("hi")
Which of the following for loops would print the following numbers?
3
5
7
9
for i in range(3, 10, 2):
print(i)
for i in range(3, 9, 2):
print(i)
for i in range(9):
print(i)
for i in range(3,9):
print(i)
What is the value of num when this loop completes?
num = 0
for i in range(2, 8, 2):
num += i
2
8
12
20
What command will ask the user his/her age correctly?
age = input("How old are you?")
age = input(How old are you?)
input("How old are you?") = age
how_old_are_you = input()
What function will convert a number to a string?
int()
str()
chr()
ord()
What is the result of this command: print ("5" + "3")
8
"8"
"5" + "3"
53
Which function will convert a string containing only digits to a number?
int()
srt()
chr()
ord()
Which conditional statement will be executed if the variable x is less than 20?
if x > 20:
if x <> 20:
if x == 20:
if x < 20:
list1 = [7,8,9,10,11]
print(list1[o])
(a)
for i in range (5, 10):
print(i)
(a)
for i in range (-3, 7):
print(i*2)
(a)
for i in range (4, 17, 3):
print(i)
(a)
for i in range (30, 2,-5):
print(i)
(a)
list1 = [7,8,9,10,11]
print(list1)
(a)
Determine the shape (output) of the program below.
from turtle import *
for i in range(8):
right(45)
forward(100)
(a)
What will be the output if the user enters 'child' and 'friday'?
£4.00
£2.50
There will be a syntax error
£2.00
What is the process of identifying and fixing errors in your code?
Rebugging
Syntax Solving
Debugging
Abstraction
What in the name of the variable in this Python code?
name
input
("What is your name")
Which of these codes is correct for creating a list of numbers?
num = ('10','29','37','109')
num = ['10','29','37','109']
num == ('10','29','37','109')
num = ['10 29 37 109']
What brackets are used to create a list?
()
[]
What will this code do?
Print Numbers 1-11
Print Numbers 1-10
Print Numbers 2-10
Print Error
NBR=0
if NBR %2 != 0:
print("The input is an ODD number")
else:
print("The input is an EVEN number")
(a)
It is used to move the turtle to the center of the screen, which is typically the coordinates (0, 0).
(a)
It moves the turtle forward by a specified distance—in this case, 25 units—in the direction it is currently facing.
(a)
It rotates the turtle's heading (direction) to the left by a specified angle—in this case, 90 degrees.
(a)
When the pen is up, the turtle will move without drawing lines on the screen.
(a)
It rotates the turtle's heading (direction) to the right by a specified angle—in this case, 45 degrees.
(a)
