0% found this document useful (0 votes)
9 views4 pages

Python Basics Module A-1

The document contains Python code examples demonstrating the use of functions and loops. It includes three separate code snippets: one for finding the maximum number from user input, another for printing multiplication tables, and a third for calculating the GCD of two numbers. Each code snippet prompts the user for input and processes it accordingly.

Uploaded by

Kavinaya V
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)
9 views4 pages

Python Basics Module A-1

The document contains Python code examples demonstrating the use of functions and loops. It includes three separate code snippets: one for finding the maximum number from user input, another for printing multiplication tables, and a third for calculating the GCD of two numbers. Each code snippet prompts the user for input and processes it accordingly.

Uploaded by

Kavinaya V
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

Python Functions

Classroom Module
A-1
Examine Output Of Code
num=[]
while True:
n=input("enter n or 'stop':")
if n=='stop':
break
else:
n=int(n)
[Link](n)
n=input("enter n or 'stop':")

print(max(num))
Examine Output Of Code
#to print multiplication tables
a=int(input('enter the number of tables:'))
b=int(input('upto which multiple:'))
i=1
while i<=a:
for j in range(1,b+1):
print(i,'*',j,'=',i*j)
i+=1
Examine Output Of Code
#to print GCD of two numbers
a=int(input('enter a:'))
b=int(input('enter b:'))
i=1
if a>b:
max=a
else:
max=b
while i<=max:
if a%i==0 and b%i==0:
gcd=i
i+=1
else:
i+=1
print('GCD is',gcd)

You might also like