#!/usr/bin/env python3
import sys
def print_sum(a, b, c):
try:
a = float(a)
b = float(b)
c = float(c)
except ValueError:
print("Function acceps numbers. Program will be stopped.")
sys.exit(0)
return a + b + c
if __name__ == "__main__":
print(print_sum(0, 5, 10))
print(print_sum(-1.5, 2.75, -10))
print(print_sum(0, 5, 'b'))
Comments
Leave a comment