OUCC

 
 
 

OUCC Tutorials

Code Submission Tasks

Exercise - Cat Words
This one is for you to try. There is a tiny bit of guidance below the question but after that, you wil only get the score feedback from the system to help you complete the task.

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:



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.

<< Back

Code submission tasks - Intro

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

Tutorials index


[ tutorials | terms | privacy | info@oucc.uk ]


UKCT Challenges are proud to use The Cuttle Platform to host our challenges.
The Cuttle system can be used for maths and science competitions, entrance exams or employee exams.