-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpseudocode.py
More file actions
34 lines (25 loc) · 1.31 KB
/
pseudocode.py
File metadata and controls
34 lines (25 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"""
Start
1. import math for calculations.
2. Store introductory text in a docustring (triple quotations) in a variable then print it.
3. Define and create a function, that can be used anytime
to handle users invalid non-numerical data.
4. Ask for and save the users input then use a while loop to instruct
the program on what to do in the case of invalid non-numerical data entry.
5. Give the condition that if the user enters a numerical string,
the users input will be converted to decimals.
6. Output an error message if non-numerical data is entered.
7. Output instructions giving the user 3 choices,
i.e. 2 possible calculations, 'interest' or 'bond' or stoping the program.
8. Create a while loop that depending on user input:
-ends the program when they want,
-returns to the original prompt if wrong data is entered and outputs an error message,
-or moves on to elif statements depending on their intial choice between the 2 calculations.
9. Within this while loop, under the elif "investment" statement,
nest another while loop that prompts the user to choose between
'simple' and 'compound' interest, outputting different results
for the calculations depending on which type of interest is chosen, also
outputting an error message if any other characters are entered
that are not 'interest' or 'compound'.
End
"""