Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 30

Python Challenge 1

Challenge 1
You will need to use:
Write a program that:
• asks the user to input their age Sequencing
• outputs 'Your age is: ' followed by their age
Variables
1 point [x1]
The program asks the us
er to
input their age.

2 points [x1]
The age is outputted.

3 points [x1]
The output includes th
e text
‘Your age is: ’ plus the
age.

Difficulty:
© ZigZag Education, 2014
1
Python Challenge 1

1 point [x1]
The program asks the us
er to
input their age.

2 points [x1]
The age is outputted.

3 points [x1]
The output includes th
e text
‘Your age is: ’ plus the
age.

© ZigZag Education, 2014


Python Challenge 2
Challenge 2
You will need to use:
Write a program that:
• asks the user to input two numbers Sequencing
• calculates the average
• outputs the result
Variables
1 point [x1]
The program asks the us
er to
input two numbers.

Tip: To calculate the average of two numbers you need 2 points [x1]
to add them together and divide them by two. The average is calculat
ed and
outputted; however, it
may not
be correct.

3 points [x1]
Difficulty:
© ZigZag Education, 2014
1 The average is calculat
correctly and outputted.
ed
Python Challenge 3
Challenge 3
You will need to use:
Write a program that:
• asks the user to input the width and height of a Sequencing
rectangle
• calculates the area
• outputs the result
Variables
1 point [x1]
The program asks the us
er to
input the width and he
ight of a
rectangle.

Tip: Multiply the width by the height to find the 2 points [x1]
The area is calculated
area of a rectangle. outputted; however, it
and
may not
be correct.

3 points [x1]

Difficulty:
© ZigZag Education, 2014
1 The area is calculated
and outputted.
correctly
Python Challenge 4
Challenge 4
You will need to use:
Write a program that:
• asks the user to input two numbers Sequencing
• divides the first number by the second number
• outputs the result
Variables
1 point [x1]
The program asks the us
er to
input two numbers.

2 points [x1]
The program divides th
e first
number by the second
number.
3 points [x1]
The result is outputted.

Difficulty:
© ZigZag Education, 2014
1
Python Challenge 5
Challenge 5
You will need to use:
Write a program that:
• asks the user their name Sequencing
• asks what their favourite subject is (using their
name in the question)
• responds to their answer by saying that you Th 1 point [x1] Variables
e program asks the user
for
like that subject as well their name and their fa
vourite
food.

2 points [x1]
The program asks the us
er for
their favourite food us
ing their
name in the question.

3 points [x1]
The program outputs a
sentence
that includes their favo

1
urite
Difficulty: food.

© ZigZag Education, 2014


Python Challenge 6
Challenge 6
You will need to use:
Write a program that:
• asks the user their name Selection
• if it is the same as your name, outputs 'You’re

Variables
cool', otherwise outputs 'Nice to meet you' 1 point [x2]
The program asks the us
er to
input their name.

2 points [x2]
If the inputted name is
the same
as the programmer ’s na
me, the
program outputs ‘You’r
e cool’.
3 points [x2]
If the inputted name is
not the
same as the programm
er ’s
name, the program outp
uts
‘Nice to meet you’.

Difficulty:
© ZigZag Education, 2014
2
Python Challenge 7
Challenge 7
You will need to use:
Write a program that:
• asks the user how long on average Selection
they spend watching TV each day 1 point [x2]
The program asks the us
• if it is less than 2 hours, outputs
‘That shouldn’t rot your brain too
long they spend on a co
per day.
er how
mputer Variables
much’; if it is less than 4 hours per 2 points [x2]
day, outputs ‘Aren’t you getting If the response is less th
outputs ‘That seems
an 2, it
square eyes?’; otherwise outputs reasonable’.
‘Fresh air beats channel flicking’ 3 points [x2]
If the response is less th
an 4, it
outputs ‘I’m surprised
you have
time for anything else!’
,
otherwise it outputs ‘Y
ou need

2
to get some fresh air on
ce in a
Difficulty: while’.
© ZigZag Education, 2014
Python Challenge 8
Challenge 8
You will need to use:
Write a program that:
• converts and outputs marks into grades, using Selection
the following data:

Greater than or equal to 75 A Variables


1 point [x2]
Greater than or equal to 60 B The program asks the us
er to
Greater than or equal to 35 C input the student’s mar
k.
Less than 35 D 2 points [x2]
The program converts
most
marks to grades correc
tly.
3 points [x2]
The program converts
all marks
to grades correctly.

Difficulty:
© ZigZag Education, 2014
2
Python Challenge 9
Challenge 9
You will need to use:
Write a program that:
• asks the user to name one of the Olympic Selection
Values (Respect, Excellence and Friendship)
• if they correctly name one, output 'That’s
correct‘, otherwise output 'Try again' 1 point [x2]
Variables
Th e program asks the user
to
input the name of one
of the
Olympic values.

2 points [x2]
The program outputs ‘T
hat’s
correct’ if they enter a
valid
Olympic value.

3 points [x2]
The program outputs ‘T
ry
again’ if they enter an
Difficulty:
© ZigZag Education, 2014
2 Olympic value.
invalid
Python Challenge 10
Challenge 10
You will need to use:
Write a game that:
• allows the user to play rock, paper, scissors Selection
against the computer
• must display the computer’s choice and show
the result of the game
Variables
1 point [x2]
The program asks the us
er to
select rock, paper or sc
issors.
2 points [x2]
The outcome of the ga
me is
Tip: The computer’s answer must be random. correctly calculated.

3 points [x2]
The computer’s answer
is
random.

Difficulty:
© ZigZag Education, 2014
2
Python Challenge 11
Challenge 11
You will need to use:
Write a program that:
• asks the user to input a sentence Variables
• calculates and outputs how many characters
there are in the sentence String Manipulation
1 point [x3]
The program asks the us
er to input a
sentence.

2 points [x3]
The program outputs th
e number of
characters in the senten
ce.
3 points [x3]
The program outputs an
appropriate
string along with the nu
mber of
characters in the senten
ce.
Difficulty:
© ZigZag Education, 2014
3
Python Challenge 12
Challenge 12
You will need to use:
Write a program that:
• asks the user to input a sentence Variables
• outputs the sentence in upper case

1 point [x3]
String Manipulation
The program asks the us
er to
input a sentence.

2 points [x3]
The program outputs th
e
original sentence.

3 points [x3]
The program outputs th
e
sentence in upper case
.

Difficulty:
© ZigZag Education, 2014
3
Python Challenge 13
Challenge 13
You will need to use:
Write a program that:
• asks the user to input a Variables
sentence
• asks the user to input:
String Manipulation
• the word they want to 1 point [x3]
The program asks the us
replace input a sentence and th
er to
e word
• the word they want to they want to replace.

replace it with 2 points [x3]


• outputs the new sentence The program outputs th
original sentence.
e

3 points [x3]
The program outputs th
e
sentence with the word

3
replaced.
Difficulty:
© ZigZag Education, 2014
Python Challenge 14
Challenge 14
You will need to use:
Write a program that:
• asks the user to input a sentence Variables
• outputs the number of times the word 'the'
occurs in it 1 point [x String Manipulation
3]
The program asks the us
er to
input a sentence.

2 points [x3]
The program counts th
e number
of times ‘the’ occurs in
it.
3 points [x3]
The program outputs th
e
number of times ‘the’ oc
curs in
it.

Difficulty:
© ZigZag Education, 2014
3
Python Challenge 15
Challenge 15
You will need to use:
Write a program that:
• asks the user to input a sentence Variables
• outputs the sentence in lower case

1 point [x3]
String Manipulation
The program asks the us
er to
input a sentence.

2 points [x3]
The program outputs th
e
original sentence.

3 points [x3]
The program outputs th
e
sentence in lower case
.

Difficulty:
© ZigZag Education, 2014
3
Python Challenge 16
Challenge 16
You will need to use:
Write a program that:
• outputs all numbers between 1 and 10 Variables
Tip: You must use a For Loop for this challenge. Repetition
1 point [x3]
The program outputs so
me
numbers to the screen.

2 points [x3]
The program outputs th
e
numbers 1 to 10.

3 points [x3]
The program uses a Fo
r loop to
output the numbers 1 to
10.
Difficulty:
© ZigZag Education, 2014
3
Python Challenge 17
Challenge 17
You will need to use:
Write a program that:
• outputs all odd numbers between Variables
1 and 99

Tip: You must use a For Loop for this challenge.


Repetition
1 point [x3]
The program outputs so
me
numbers to the screen.

2 points [x3]
The program outputs so
me odd
numbers.

3 points [x3]
The program outputs al
l the odd
numbers from 1 to 99.
Difficulty:
© ZigZag Education, 2014
3
Python Challenge 18
Challenge 18
You will need to use:
Write a program that:
• asks the user to input a number Variables
• outputs the times table for that number
Repetition
Tip: You must use a For Loop for this challenge.
1 point [x3]
The program asks the us
er to
input a number.

2 points [x3]
The program outputs th
e time
table for the inputted nu
mber.
3 points [x3]
The program includes
a For
loop to generate the tim
Difficulty:
© ZigZag Education, 2014
3 es table.
Python Challenge 19
Challenge 19
You will need to use:
Write a program that:
• asks the user to input a number Variables
• outputs the times table for that number
• starts again every time it finishes
Repetition
1 point [x3]
The program asks the us
er to
input a number.
Tip: You must use a For Loop and a
While Loop for this challenge. 2 points [x3]
The program outputs th
e times
table for the number gi
ven.
3 points [x3]
A While loop has been
used to
make the program repe
at
forever.
Difficulty:
© ZigZag Education, 2014
3
Python Challenge 20
Challenge 20
You will need to use:
Write a program that:
• asks the user to input a number and repeats Variables
until they guess the number 7
• congratulate the user with a ‘Well Done’
message when they guess correctly
Repetition
1 point [x3]
The program asks the us
er to
guess the number.

2 points [x3]
If they input the numbe
r 7, the
program will output ‘W
ell
Done’.

3 points [x3]
The program loops until

3
the
Difficulty: user inputs the number
7.
© ZigZag Education, 2014
You will need to use:
Python Challenge 21 Variables
Challenge 21 Selection
Write a program that converts between centimetres,
and inches and vice versa, by:
• asking the user to input a number 1 point [x3]
Functions
• asking the user to choose between converting The program asks the us
er to
from centimetres to inches or from inches to choose the type of the
conversion they want to
centimetres out and to input the nu
carry
• calculating and outputting the result using mber
they want to convert.
functions
2 points [x3]
The program correctly
converts
between inches and ce
ntimetres.

Tip: 1 inch = 2.54 cm 3 points [x3]


The program uses sepa
1 cm = 0.393700787 inches functions to convert be
rate
tween
inches and centimetres.

Difficulty:
© ZigZag Education, 2014
3
Python Challenge 22
Challenge 22
You will need to use:
Write a program that:
• asks the user for the distance (in metres) Variables
• asks the user for the time in seconds that a
journey was completed in
• calculates and outputs the average speed using
Selection
a function 1 point [x3]
The program asks the us
input the distance and
er to
time.
Functions
2 points [x3]
The program correctly
Tip: Speed = Distance / Time calculates the average
speed.
3 points [x3]
The program uses a fu
nction to
calculate the average sp
eed.
Difficulty:
© ZigZag Education, 2014
3
Python Challenge 23 You will need to use:

Variables
Challenge 23
A gardener needs to buy some turf for a project they are Selection
working on. The garden is rectangular with a circular
flower bed in the middle.
Functions
Write a program that: 1 point [x4]
• asks the user for the dimensions of the lawn and the The program asks the us
er to
input the dimensions of
radius of the circle (in metres) lawn and the radius of
the
the
• uses a function to calculate and output the amount circle.
of turf needed 2 points [x4]
The program correctly
calculates the amount
of turf
Tip: Circle area = Pi x Radius2 required.

3 points [x4]
The program uses a fu
nction to
calculate the amount of
turf
Difficulty:
© ZigZag Education, 2014
4 required.
Python Challenge 24 You will need to use:
Variables
Challenge 24 Selection
Write a function that takes two numbers. Repetition
The first number indicates the number of spaces Functions
that should be displayed and the second indicates 1 point [x4]
the number of Xs that should be displayed. These The program displays
a number
of spaces followed by
a number
should both be displayed on the same line. of Xs on the same line.

Now write another function that makes multiple 2 points [x4]


The program uses a fu
calls to your first function and draws a picture output a set number of
nction to
spaces
with Xs. and Xs on the same lin
e.
3 points [x4]
The program uses anot
her
function to draw a pict
ure using
the first function.

Difficulty:
© ZigZag Education, 2014
4
Python Challenge 25
Challenge 25
You will need to use:
Write a sign-up program for an after-school club;
it should ask the user for the following details Variables
and store them in a file:

• First Name
1 point [x4] Selection
The program asks the us
er to
• Last Name input their First Name,
Last
• Gender
Name, Gender and Form
. File Handling
• Form 2 points [x4]
The data is stored in an
external
text file.

3 points [x4]
The data is stored with
appropriate labels in an
external
text file.
Difficulty:
© ZigZag Education, 2014
4
Python Challenge 26 You will need to use:
Variables
Challenge 26 Selection
Write a maths quiz with three questions. Functions
File Handling
It must ask the user to input their name at the 1 point [x4]
start. The program asks the us
er to
input their name and th
en asks
three maths questions.
At the end it should display a message informing
the user of their score. 2 points [x4]
At the end of the questio
ns the
program displays the us
Write a function that saves the user’s name and name followed by thei
er ’s
r score.
quiz result in a text file.
3 points [x4]
A function has been us
ed to
save the user ’s name an
d quiz
result to a text file.

Difficulty:
© ZigZag Education, 2014
4
Python Challenge 27
Challenge 27
You will need to use:
Extend your maths quiz program from Challenge
20 by including a list of the scores of people that Variables
have taken the quiz before.

1 point [x5] Selection


The program opens an
external
file.

2 points [x5]
File Handling
The program loads the
scores
from an external file.

3 points [x5]
The program displays
the scores
from an external file.

Difficulty:
© ZigZag Education, 2014
5
Python Challenge 28
Challenge 28
You will need to use:
Write a random name generator that asks for the
user to input 5 names, stores them in an array and Variables
then outputs one of them at random.

1 point [x5]
Repetition
The program asks the us
er to
input 5 names.

2 points [x5]
Arrays
The program stores the
names
in an array.

3 points [x5]
The program outputs a
random
name from the array.

Difficulty:
© ZigZag Education, 2014
5
Python Challenge 29
Challenge 29
Write a program that allows the user to
1 point [x5] You will need to use:
The program asks the us
er for the
create and store a checklist for a holiday. destination of their holid
ay, how
It should start by asking them the
many things they need
how many tasks they ne
to pack and
ed to
Variables
complete.
destination of the holiday, how many
things they need to pack and how many
tasks they need to complete to prepare.
2 points [x5]
The program should us
e a For loop
Repetition
to ask the user to input
each item
The user should then be able to enter they need to pack and ea
ch task
each item they need to pack and each
they need to complete.
Arrays
task they need to complete. 3 points [x5]
The program should sto
File Handling
re the
inputted data in an exte
rnal file in
a clear and easy-to-read
format.

Difficulty:
© ZigZag Education, 2014
5

You might also like