0% found this document useful (0 votes)
21 views5 pages

Presentation 1

The document contains several Python functions that manipulate strings, perform arithmetic operations, and manage global variables. It includes functions to display modified strings, alter values with default parameters, calculate the sum of odd numbers, and change global variables based on conditions. The document demonstrates the use of global variables and function calls with varying arguments.

Uploaded by

Mafnitha KK
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views5 pages

Presentation 1

The document contains several Python functions that manipulate strings, perform arithmetic operations, and manage global variables. It includes functions to display modified strings, alter values with default parameters, calculate the sum of odd numbers, and change global variables based on conditions. The document demonstrates the use of global variables and function calls with varying arguments.

Uploaded by

Mafnitha KK
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 5

def display(s):

l = len(s)
m=""
for i in range(0,l):
if s[i].isupper():
m=m+s[i].lower()
elif s[i].isalpha():
m=m+s[i].upper()
elif s[i].isdigit():
m=m+"$"
else:
m=m+"*"
print(m)
display("[email protected]")
def Alter(M,N=50):
M=M+N
N=M-N
print(M,"@",N)
return M
A=200
B=100
A = Alter(A,B)
print(A,"#",B)
B = Alter(B)
print(A,‟@‟,B)
def Total(Number=10):
Sum=0
for C in range(1,Number+1):
if C%2==0:
continue
Sum+=C
return Sum
print(Total(4))
print(Total(7))
print(Total())
X = 100
def Change(P=10, Q=25):
global X
if P%6==0:
X+=100
else:
X+=50
Sum=P+Q+X
print(P,'#',Q,'$',Sum)
Change()
Change(18,50)
Change(30,100)
a=100
def show():
global a
a=200
def invoke():
global a
a=500
show()
invoke()
print(a)

You might also like