This session contains examples and problems for the practice on using the print and input functions.
All practice exercises are not assessed, but are there to enhance your learning.
Remember that it is better to try and work out the solution, and not succeed than it is to simply use Google, Bing, or AI to find a solution and copy the code.
We have, for this session, provided you with the starter stub code, but you must complete the comments with the relevant details for each problem.
Filename: session-02/totaliser.py
Write a program that, asks the user for their name, and then asks the user for a number, plus asks the user for a second number.
The program is then to calculate the total of the two numbers, before displaying the results in a form similar to:
Jane, the total of 2 and 4 is 6
Remember to convert the input from text (strings) to integers before using the values...
number = input("Number 1: ")
number = int(number)
Filename: session-02/multiplier.py
Write a program to accept two numbers from the user. The program then will calculate the result of multiplying the two numbers together. Finally, the program will display the result in a manner similar to:
7 times 8 equals 56
Filename: session-02/constant-stars.py
Write a program that uses the print() function to display three words (store them in CONSTANTS) in the form:
Python**is**Brilliant
Filename: session-02/number-again.py
Write a program that asks the user for a number. The program is then to calculate the total of the number entered and the number plus 1.
Finally, the result will be output in the form:
10 + 11 = 21