@lakshayarora7/

ScalyStridentIbadanmalimbe

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# Sum of 3 numbers
# A simple program of adding 3 given numbers, handling exception in case user inputs anything other than digits.

# asking for inputs
try:
    numberOne = float(input("Please enter the first number: "))
    numberTwo = float(input("Please enter the second number: "))
    numberThree = float(input("Please enter the third number: "))
except ValueError:
    print("That was not a number!")

# displaying total
try:
    print("Total: ", str(numberOne + numberTwo + numberThree))
except NameError:
    print("Cannot compute sum. Please execute the program again.")