1+ """imports the os and time modules from the Python Standard Library.
2+ The os module provides a way of using operating system dependent functionality,
3+ like reading or writing to the file system.
4+ The time module provides various time-related functions, like getting the current
5+ time or pausing the execution of the script."""
6+
17import os
28import time
39
410
511def addition ():
12+ """This function asks the user to enter a series of numbers separated by spaces.
13+ It then adds all the numbers together and returns the result."""
614 nums = list (map (int , input ("Enter all numbers seperated by space: " ).split ()))
715 return sum (nums )
816
917
1018def subtraction ():
11- n1 = float (input ("Enter first number: " ))
12- n2 = float (input ("Enter second number: " ))
19+ """This function asks the user to enter two numbers.
20+ It then subtracts the second number from the first and returns the result."""
21+ n_1 = float (input ("Enter first number: " ))
22+ n_2 = float (input ("Enter second number: " ))
1323
14- return n1 - n2
24+ return n_1 - n_2
1525
1626
1727def multiplication ():
28+ """Function asks user to enter a series of numbers separated by spaces.
29+ Then multiply all the numbers together and returns the result."""
30+
1831 nums = list (map (int , input ("Enter all numbers seperated by space: " ).split ()))
19- res = 1
32+ result = 1
2033 for num in nums :
21- res *= num
22- return res
34+ result *= num
35+ return result
2336
2437
2538def division ():
39+ """Function divide two numbers"""
2640 n1 = float (input ("Enter first number: " ))
2741 n2 = float (input ("Enter second number: " ))
2842 if n2 == 0 :
@@ -34,6 +48,9 @@ def division():
3448
3549
3650def average ():
51+ """This function takes space seperated number series and then convert it to a list.
52+ Then calculates the average of that list of numbers."""
53+
3754 nums = list (map (int , input ("Enter all numbers seperated by space: " ).split ()))
3855 return sum (nums ) / len (nums )
3956
0 commit comments