[Link] are the errors in following codes ?
Correct the code and predict
output :
total = 0;
def sum(arg1, arg2):
total = arg1 + arg2;
print("Total :", total)
return total;
sum(10, 20);
print("Total :", total)
[Link] are the errors in following codes ? Correct the code and predict
output :
def Tot(Number) #Method to find Total
Sum = 0
for C in Range (1, Number + 1):
Sum += C
RETURN Sum
print (Tot[3]) #Function Calls
print (Tot[6])
[Link] and write the output of the following python code :
def Call(P = 40, Q = 20):
P = P + Q
Q = P - Q
print(P, '@', Q)
return P
R = 200
S = 100
R = Call(R, S)
print(R, '@', S)
S = Call(S)
print(R, '@', S)
[Link] the following code and write the flow of execution for this. Line
numbers have been given for your reference.
1. def power(b, p):
2. y = b ** p
3. return y
4.
5. def calcSquare(x):
6. a = power(x, 2)
7. return a
8.
9. n = 5
10. result = calcSquare(n)
11. print(result)
[Link] will be the output of following program ?
num = 1
def myfunc():
num = 10
return num
print(num)
print(myfunc())
print(num)
[Link] will be the output of following program ?
num = 1
def myfunc():
global num
num = 10
return num
print(num)
print(myfunc())
[Link] will be the output of following program ?
def display():
print("Hello", end='')
display()
print("there!")
[Link] the errors in code given below :
define check()
N = input ('Enter N: ')
i = 3
answer = 1 + i ** 4 / N
Return answer
[Link] the errors in code given below :
def alpha (n, string = 'xyz', k = 10):
return beta(string)
return n
def beta (string)
return string == str(n)
print(alpha("Valentine's Day"):)
print(beta(string = 'true'))
print(alpha(n = 5, "Good-bye"):)
[Link] the following code, which variables are in the same scope ?
def func1():
a = 1
b = 2
def func2():
c = 3
d = 4
e = 5