File tree 2 files changed +24
-225
lines changed
2 files changed +24
-225
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ __author__ = "Nitkarsh Chourasia"
2
+ __version__ = "1.0"
3
+ def addition (
4
+ num1 : typing .Union [int , float ],
5
+ num2 : typing .Union [int , float ]
6
+ ) -> str :
7
+ """A function to add two given numbers."""
8
+
9
+ # Checking if the given parameters are numerical or not.
10
+ if not isinstance (num1 , (int , float )):
11
+ return "Please input numerical values only for num1."
12
+ if not isinstance (num2 , (int , float )):
13
+ return "Please input numerical values only for num2."
14
+
15
+ # Adding the given parameters.
16
+ sum_result = num1 + num2
17
+
18
+ # returning the result.
19
+ return f"The sum of { num1 } and { num2 } is: { sum_result } "
20
+ )
21
+
22
+ print (addition (5 , 10 )) # This will use the provided parameters
23
+ print (addition (2 , 2 ))
24
+ print (addition (- 3 , - 5 ))
You can’t perform that action at this time.
0 commit comments