part 2 16. Complete the function my_mathi), this program accepts a positive integer and a plus sign or you. After that i
Posted: Mon May 09, 2022 6:29 am
part 2 16. Complete the function my_mathi), this program accepts a positive integer and a plus sign or you. After that it will add or multiply each digit together as in the example in the program -function my math) retums the sum of each digit together. If the user enters the ampersand function my math) returns the product of the individual digits together. It the disser enters a maribor The function my math ) retums 1 it the user did not enter a + or Let's say the went to or more digits of a poteger note - The mark" indicates the beginning of the line underlined Displays user input Running example 1 Input positive integer and operator [+ or ): 123 Result: Example run 2 >input positive integer and operator (+ or *); 456.. >Result: 120 Example of day 3 >Input positive integer and operator (tor): 123/ Sinvalid operator defmy_mathinteger, operator) def main Integer, operator input'input positive integer and operator (tor"): ") split result = my_mathinteger, operator) if result 1 printif Result result else: print"Invalid operator") main()