[go: up one dir, main page]

0% found this document useful (0 votes)
10 views1 page

Working With Functions - Worksheet 4

The document is a worksheet for Class 12 students at The PSBB Millennium School, focused on functions in programming. It includes various coding exercises that involve defining functions, using global and local variables, and manipulating lists. Additionally, it contains questions about programming concepts such as local and global scope and types of functions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views1 page

Working With Functions - Worksheet 4

The document is a worksheet for Class 12 students at The PSBB Millennium School, focused on functions in programming. It includes various coding exercises that involve defining functions, using global and local variables, and manipulating lists. Additionally, it contains questions about programming concepts such as local and global scope and types of functions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

THE PSBB MILLENNIUM SCHOOL

GST & GERUGAMBAKKAM


WORKING WITH FUNCTIONS – WORKKSHEET 5
CLASS 12 – MARKS 15
1. (2M) 2. (2M)
X = 100 def Fun1(mylist):
def Change(P=10, Q=25): for i in range(len(mylist)):
global X if mylist[i]%2==0:
if P%6==0: mylist[i]/=2
X+=100 else:
else: mylist[i]*=2
X+=50 list1 =[21,20,6,7,9,18,100,50,13]
Sum=P+Q+X Fun1(list1)
print(P,'#',Q,'$',Sum) print(list1)
Change()
Change(18,50)
Change(30,100)
3. (2M) 4. (2M)
def check(): def drawline(char='$',time=5):
global num print(char*time)
num=1000 drawline()
print(num) drawline('@',10) drawline(65) drawline(chr(65))
num=100
print(num)
check()
print(num)
5. (2M) 6. (2M)
def Updater(A,B=5): def display(s):
A = A // B l = len(s)
B=A%B m=""
print(A,'$',B) for i in range(0,l):
return A + B if s[i].isupper():
A=100,B=30 m=m+s[i].lower()
A = Updater(A,B) elif s[i].isalpha():
print(A,'#',B) m=m+s[i].upper()
B = Updater(B) elif s[i].isdigit():
print(A,'#',B) m=m+"$"
A = Updater(A) else:
print(A,'$',B) m=m+"*"
print(m)
display("EXAM20@cbse.com")
7. Explain local and global scope with relevant example. (2M)
8. A function that returns a value is called as _________________ or _____________ function. (1M)

You might also like