Q.2)'''Write an interactive python program to perform the following. 1.To input 2 integers and generate 1 random numbers. 2.To pass an integer argument and return the no: of digits. 3.To pass 2 integer argument and operator to perform operations of a calculator. 4.Exit''' import random def generate(): for i in range(10): print(random.randint(low,up),end='\\t') def countdigit(n): c=0 while n!=0: c+=1 n//=10 print('the number of digits is',c) def calculator(a,op,b): if op=='+': s=a+b print('Sum is',s) elif op=='-': d=a-b print('Difference is',d) elif op=='*': m=a*b print('Multiplication is',m) elif op=='/': s=a+b print('Quotient is',qt) ch=1 while ch!=4: print("1.To input 2 integers and generate 1 random numbers") print("2.To pass an integer argument and return the no: of digits.") print("3.To pass 2 integer argument and operator to perform operations of a calculator.") print("4. To Exit") ch=int(input("Enter choice:")) if ch==1: low=int(input("Enter lower range")) up=int(input("Enter upper range")) generate() elif ch==2: n=int(input("Enter number")) countdigit(n) elif ch==3: a=int(input("Enter First number")) b=int(input("Enter Second number")) op=input("Enter operator") calculator(a,op,b) elif ch!=4: print("Invalid choice") print("-"*20) ''' OUTPUT ''' 1.To input 2 integers and generate 1 random numbers 2.To pass an integer argument and return the no: of digits. 3.To pass 2 integer argument and operator to perform operations of a calculator. 4. To Exit Enter choice: 1 Enter lower range 4 Enter upper range 8 7 6 6 6 4 5 5 7 5 4 -------------------- 1.To input 2 integers and generate 1 random numbers 2.To pass an integer argument and return the no: of digits. 3.To pass 2 integer argument and operator to perform operations of a calculator. 4. To Exit Enter choice: 2 Enter number 9945 the number of digits is 4 -------------------- 1.To input 2 integers and generate 1 random numbers 2.To pass an integer argument and return the no: of digits. 3.To pass 2 integer argument and operator to perform operations of a calculator. 4. To Exit Enter choice: 3 Enter First number 5 Enter Second number 5 Enter operator + -------------------- 1.To input 2 integers and generate 1 random numbers 2.To pass an integer argument and return the no: of digits. 3.To pass 2 integer argument and operator to perform operations of a calculator. 4. To Exit Enter choice: 3 Enter First number 6 Enter Second number 9 Enter operator* Multiplication is 54 -------------------- 1.To input 2 integers and generate 1 random numbers 2.To pass an integer argument and return the no: of digits. 3.To pass 2 integer argument and operator to perform operations of a calculator. 4. To Exit Enter choice:3 Enter First number 8 Enter Second number4 Enter operator- Difference is 4 -------------------- 1.To input 2 integers and generate 1 random numbers 2.To pass an integer argument and return the no: of digits. 3.To pass 2 integer argument and operator to perform operations of a calculator. 4. To Exit Enter choice:4 --------------------