Python Resource Pack 1 is a set of coding challenges designed to support the teaching and learning of the Python programming language.
This pack is designed for anyone who has no experience of programming in Python, or no experience of programming at all. It is suitable for teaching Python in schools from Year 7 onwards, tutors and learners in adult learning classes or for the hobbyist learning at home.
The pack is designed to support learning that has previously taken place in the classroom, via self-directed study, or by following tutorials.
The pack contains:
- A pdf file with eight coding challenges.
- Fully commented example solutions to each of the challenges.
The following topics are introduced:
- Displaying text on the screen with the print command.
- The
input
command to accept data typed in by the program’s user. - Using variables to store data.
- The
int
command to convert text strings to integers (whole numbers). - The
for
command to perform commands more than once in count controlled loops. - The
/n
newline command. - The
.title()
command to capitalize the first letter in a string. - String concatenation.
- String replication.
- The
str
command to convert other data types into strings. - Basic mathematics.
- The
float
command to convert text strings to real numbers (decimals). - The
if
command to perform instructions if a condition is met. - The
if… else
command to perform instructions if a condition is met and alternative instructions if not. - The
while
command to perform commands more than once in condition controlled loops. - The comparison operators.
- The
break
command to jump out of instructions.
The challenges are designed so that a degree of self-directed research will be required to complete them; they are not a cut-and-paste tutorial.
The challenges:
- A single line program which prints your name four times.
- A single line program which prints a box.
- Print "Hello " followed by a name with the first letter capitalised.
- Input a first name and surname, capitalise them and print them three times.
- Calculate an area from an input width and length then print it with an informative message.
- Input a number and display a different message depending on the number entered.
- Set a password and allow as many input attempts as necessary to let the user input it correctly. Includes extension work.
- Set a password and allow five attempts to let the user input it correctly, displaying appropriate messages if they succeed or not.