Answer The Following Questions Using Python Programming Language
Answer The Following Questions Using Python Programming Language
Interest(20000,.08,15) #Line 1
Interest(T=10,20000,.075) #Line 2
Interest(50000,.07) #Line 3
Interest(P=10000,R=.06,Time=8) #Line 4
Interest(80000,T=10) #Line 5
7. What will be the output of following code? Which argument method 2
is used in the following program?
def sum(*n):
s=0
for i in n:
print i
sum()
sum(10)
sum(10,20)
sum(10,20,30)
8. What will be the output of following code? 2
def drawline(char='$',time=5):
print(char*time)
drawline()
drawline('@',10)
drawline(65)
drawline(chr(65))
9. Call the given function using KEYWORD ARGUMENT method, 2
with values 20 and 30
def Swap(num1,num2):
num1,num2=num2,num1
print(num1,num2)
10. Write the output of the following python code: 2
msg = "World is Beautiful again 2022"
print(msg[3:])
print(msg[:4],msg[4:])
print(msg[::-1])
print(msg[0:4],msg[11:10])
11. What possible outputs(s) are expected to be displayed at the time of execution 2
of the following code? Specify the maximum possible value that would be
assigned to each of the variables FROM and TO.
import random AR=[20,30,40,50,60,70];
FROM=random.randint(1,3)
TO=random.randint(2,4)
for K in range(FROM,TO+1):
print (AR[K],end=”#“)
13. Does the given function represent recursion? How many times will this 2
function execute?
14. Write a function “fibo” that takes a number n and display the nth term of 2
Fibonacci series.