ungleich-learning-circle/sami/learn-python-the-hard-way/calc2.py

13 lines
257 B
Python

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)