You are on page 1of 3

"""

NAME: ABHAY VERMA


SECTION: AU01
SUBJECT: PYTHON PROGRAMMING
CLG: GLA UNIVERSITY MATHURA
"""
# LAB SHEET 1: PYTHON BASICS

#PROG 1:PRINT USE


print("hello world",end=" ")
print("Abhay Verma",end=" ")
print("section AU \nRoll no. 1")

hello world Abhay Verma section AU


Roll no. 1

#PROG 2: SUM
a=10
b=20
print("The sum:",a+b)

The sum: 30

#PROG 3: MATH OPERATIONS


a=24
b=5
print("The sum:",a+b)
print("The product:",a*b)
print("The division:",a/b)
print("The floor division:",a//b)
print("The remainder:",a%b)

The product: 120


The division: 4.8
The floor division: 4
The remainder: 4

#PROG 4: Keyword list


import keyword as rev_words
print(rev_words.kwlist)

['False', 'None', 'True', 'and', 'as', 'assert', 'async', 'await',


'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except',
'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is',
'lambda', 'nonlocal', 'not', 'or', 'pass', 'raise', 'return', 'try',
'while', 'with', 'yield']

#PROG 5: Area of Circle


r=12
area=3.14*(r**2)
print("Area of circle :",area)
Area of circle : 452.16

#PROG 6: Swap of two Numbers


a=int(input("Enter the No. O1 :"))
b=int(input("Enter the No. O2 :"))
c=a
a=b
a=c
print("After swap \nNumber.1 =",a,"and Number.2 =",b);

Enter the No. O1 : 23


Enter the No. O2 : 32

After swap
No.1 = 23 and No.2 = 32

#PROG 7: Greatest number between two


a=int(input("Enter the No. O1 :"))
b=int(input("Enter the No. O2 :"))

#PROG 8: Check Even or Odd


num=int(input("Enter number"))
if(num%2==0):
print(num,"is an Even number")
else:
print(num,"is an Odd number")

Enter number 454

454 is an Even number

#PROG 9: Check (Positive, Negative and Zero)


num=int(input("Enter number"))
if(num>0):
print(num,"is an Positive")
elif(num==0):
print(num,"is Zero")
else:
print(num,"is an Negative")

Enter number 444

444 is an Positive

#PROG 10: Divisiblity check


n=int(input("Enter number"))
k=int(input("Enter divisibility"))
if(n%k==0):
print("Yes")
else:
print("No")
enter number 33
Enter divisibility 3

Yes

#PROG 11: Check Last digit


n=int(input("Enter number"))
k=int(input("Enter last digit"))
if(n%10==k):
print("Yes! last digit is",k)
else:
print("No! last digit is not",k)

enter number 54
Enter last digit 4

last digit is 4

#PROG 12:
i=0
while i<5:
print("sorry" ,end=" ")
i=i+1

sorry sorry sorry sorry sorry

You might also like