Year 10 Information Technology: Python Programming Task

vetinnocentSoftware and s/w Development

Nov 7, 2013 (4 years and 1 month ago)

73 views


Year 10 Information Technology: Python Programming Task

Now that you have been making Python programs for a few weeks you have the knowledge and
skills to make a simple programme of your own.

Programme description

The program you make will have a menu
that allows users to choose
what they want to do. The first option will be to multiply two
number
s
, the second option will be to add two numbers and the third
option will be to count the characters in a string. They can also type
“quit” to exit the progr
am. The menu should look something like this:

Welcome to the menu program.

Please select from the menu by typing the number.

To exit the program, type 'quit'


1. Multiply two numbers


2. Add two numbers


3. Count characters in a string

Choose
a number:


When the user types 1, the program will ask for two numbers and then give the result in the
following format:

3 x 4 = 12

When the user types 2, the program will ask for two number
s

and then give the result in the
following format:

2 + 2 = 4

When

the user types 3, the program will ask for some text and then report to the user:

There are 11 characters in that string.

Once the program is started up it should keep showing the menu until the user types “quit”

If the user types an option other than 1, 2, 3 or quit, they should get a message like:

That is not a valid option. Please enter 1, 2, 3 or quit.

Resources

All the programs you have written so far contain the methods you need to complete this task. The
teacher will be on hand to guide you and you can consult with your fellow students for assistance.
Also take notice of the marking key on the next page for hints on what might be required.

Suggested method

1.

Start by trying to get the menu to display proper
ly.

2.

Then work on getting the menu to respond differently when different numbers are typed.
To show that they work you could just print a different message for each option. Don’t
forget to put in an error message.

3.

Make the program loop so that after an op
tion is chosen, the menu displays again.

4.

Once the menu and the looping works then put in the code to make each menu option
work with the multiplication, addition and string counting.


Python Programming Task Marking key


Task description

Possible
Marks

You
r Marks

D
isplay
:



Menu



Mulitplication



Addition



String count



Error message


2

1

1

1

1


Sub
-
Total

6


Functionality:



Menu



Multiplication



Addition



String count



Looping



Branching


4

2

2

2

2

2


Sub
-
Total

14


Total

20