s Wite to ou flowing list11.231 list 2-listi list2 st1 + 4 print/list1-1:21) & the uplowing def mythia, by return as pri
Posted: Mon May 09, 2022 6:22 am
s Wite to ou flowing list11.231 list 2-listi list2 st1 + 4 print/list1-1:21) & the uplowing def mythia, by return as print(myth('a,3), myth(5,2), mythl|11, 21 7. Fil in the missing parts of the code by iting a slice of the lisz to give the program cutput 19, 6,3 number1 = 1,2.3.4.5.6.7.8,91 number2 = number 1 print number2) Write the following program bubut de defintly 3, 23) return x+y+2 dat 2 x=1 return x+y defin3[y-3, 2-4) global +2 23 return fn1), y, fn2(2). printin3(4)
Who the output state of the towny program a = 3, 2, 7, 11 asort a reverse print(a) to win the boat of the wing de myth(a, b, no for iin rangela, b1) ifric 0 na1 return print myth 3, 10, 4)) Write the data of the foorum list1 = [['Joe'. Kim'lim'l. 'Sam', 'Sue', 'Sun'i. ['Kelly, Chris, Annie'll list20 I=0 for name in list: List2.append(lista[-11) 11 list2.sort) for name in list: printiname, ende! 12 Write the data of the following prog import math for iin range (0, 100,90) printi, format(math.sin(math.radians(0).2), ends
13. Fill in the code that is missing, so that the program's output 4.5.6.9.8. 7 list 111,2,3), (4,5,6), (7,8,911 list1 list111 listi printflist) 14 Wote the pots of the following prog s10 52 = 0 530 fore in "I love python. Do you? If cisupper s11 elif cislowers 32 += 1 elif c.isspace) 5 print 51, 52, 53) 15. With pidato ortofotowing a 3,5,2) printa+a+2)
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()
Who the output state of the towny program a = 3, 2, 7, 11 asort a reverse print(a) to win the boat of the wing de myth(a, b, no for iin rangela, b1) ifric 0 na1 return print myth 3, 10, 4)) Write the data of the foorum list1 = [['Joe'. Kim'lim'l. 'Sam', 'Sue', 'Sun'i. ['Kelly, Chris, Annie'll list20 I=0 for name in list: List2.append(lista[-11) 11 list2.sort) for name in list: printiname, ende! 12 Write the data of the following prog import math for iin range (0, 100,90) printi, format(math.sin(math.radians(0).2), ends
13. Fill in the code that is missing, so that the program's output 4.5.6.9.8. 7 list 111,2,3), (4,5,6), (7,8,911 list1 list111 listi printflist) 14 Wote the pots of the following prog s10 52 = 0 530 fore in "I love python. Do you? If cisupper s11 elif cislowers 32 += 1 elif c.isspace) 5 print 51, 52, 53) 15. With pidato ortofotowing a 3,5,2) printa+a+2)
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()