Learning-cicle/sami/learn-python-the-hard-way/calc2.py

14 lines
257 B
Python
Raw Normal View History

2020-06-01 14:58:46 +00:00
def add(a,b):
# calculating the sum
sum=a+b
#opening the file in an append mode
file = open('output.txt',"a")
file.write(f'Sum of {a} and {b} is {sum}\n')
#at last i close the file
file.close()
#call the function
add(5,7)
add(2,6)