Python Skills Worksheet 1
Python Skills Worksheet 1
Python Skills Worksheet 1
1. Debugging
Rewrite and test the following code, making sure you remove all of the errors.
target = 12
guesses = 0
userChoice = input(“Guess the number: ”)
while userChoice == target
guess = guess * 1
if UserChoice > target:
print(“Guess higher!”)
else:
print(Guess lower!”)
print(“It took you” , userChoice, “guesses”)
Rewrite and test the following code, making sure you remove all of the errors.
worldRecord = False
lane = 1
athlete = input(“Who is in lane” + lane + “? ”)
country = input(“Which country does” + athlete + “represent? ”)
time = input(“Enter the 100m time for” , athlete)
print(“Competitor: ” , athlete)
print(“Country: ” + country)
print(“Lane number: ” + lane)
print(“100m time: ” + time)
print(“New world record: ” + worldRecord)
1
Worksheet 1
Practical programming skills in Python
3. Arithmetic
c. numbers: 3, 7, 2, 15, 6
o Total = 33, Average = 6.6
d. radius = 6
o Circumference = 37.68, Area = 113.04
e. number = 4
2
Worksheet 1
Practical programming skills in Python
o Square = 16, Number6 = 4096, Square Root = 2
4. Extension
Find a copy of some typical formulae you would need for maths (or physics).
You might have a reminder of the key formulae in your student planner, in a text book or in
your exercise book. If you don’t have one then try searching for “gcse maths formulae”
online.
Create a program that will carry out calculations using a wide range of different formulae –
making sure you can complete the formulae with whole numbers and with fractional
numbers where necessary.
Create a menu system so that the user can choose which calculations to carry out.