- Write a short note on Function Scope? Write the difference between Global and Local Scope of Variable?
- Write the output of the below code:
def Func(s1,s2): var1 = s1 not in s2 var2 = str(var1) < 'T' return var1,var2 s1="jap" s2="Japan" var1,var2=Func(s1,s2) print(var1,var2,sep="###",end="---")
- Write the definition of a method OddSum(NUMBERS) to add those values in the list of NUMBERS, which are odd.
- Find and write the output of the following python code :
def Changer(P,Q=10): P=P/Q Q=P%Q print(P,"#",Q) return P A=200 B=20 A=Changer(A,B) print (A,"$",B) B=Changer(B) print (A,"$",B) A=Changer(A) print (A,"$",B)
- Write the definition of a method/function HowMany(ID,Val) to count and display the number of times the value of Val is present in the list ID.
For example : If the ID contains [115,122,137,110,122,113] and Val contains 122 The function should display 122 found 2 Times
- Write a function to sort the Linear List? (Do not use list Functions)
- Predict the output of the following code fragment :
1 2 3 4 5 6 7
def check(n1=1, n2=2): n1=n1+n2 n2+=1 print(n1,n2) check( ) check(2,1) check(3)
No comments:
Post a Comment