Text-based programming tasks - code submission

Example 3 - Cat Words

This exercise introduces multiple lines of input. To handle these your code will need to call for standard input to get the first line of input and then make another call in the same way to get the second line, etc.

Now read the task:

Try this out in a new window ...

Each time you make a call to standard input your program will import one line of input at a time. So, in Python, you will need a line of code such as:

n = int(input()) #Get number of test data sets

to find out how many words there are. Then, at some point, you will want to loop through each input and collect and handle each word with some code like this:

for _ in range(n):
    nextWord = input()
    #Do something with the imported word here

Now try and write a program that gets 100% when submitted above.

Important Note:
Remember, do not send a string to standard output asking for input:
my_string = input() is correct
my_string = input("Please enter your first number: ") will fail all tests.

Code submission tasks - Intro

Example 1 - Hello, World!
Example 2 - Postfix
Exercise - Cat Words



Did you know the UK Bebras Challenge is run by the Raspberry Pi Foundation? Discover free teaching resources, tools, and expert support for computing education at raspberrypi.org.