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
--------------------
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}