IA1 Python-SchemeJLBNHL'
IA1 Python-SchemeJLBNHL'
SCHEME OF EVALUATION
Course Name Introduction to Python Programming Course Code 24PLC15B
27-11-2024
Branch & Semester Ist Semester CSE(Section 1-14) Date
[9:30AM to 11:00AM]
Name of the Course SR,CV,MKR,BS,CA,NP,AR,VP,MK,SS,MM,H
Max. Marks 40
Coordinator (s) KN,PG,GP
Output: —---1mrk
Enter the basic salary: 18000
Enter the HRA: 900
Enter the DA: 2500
Enter the loan amount: 4000
Net salary: 17400.0
OR
2. a 1.It can be only one word. 4M CO1,K2
2. It can use only letters, numbers, and the underscore (_) character.
3. It can’t begin with a number.
BMS INSTITUTE OF TECHNOLOGY AND MANAGEMENT
Avalahalli, Doddaballapura Main Road, Bengaluru - 560064
FIRST INTERNAL ASSESSMENT TEST, November-2024
else:
elif age>12:
if status == "yes":
ticket_price = 100 - (100 * 0.1)
print("your ticket price isL:",ticket_price)
elif status == "no":
ticket_price = 100
print("your ticket price isL:", ticket_price)
else:
print("invalid membership")
else:
print("invalid age")
BMS INSTITUTE OF TECHNOLOGY AND MANAGEMENT
Avalahalli, Doddaballapura Main Road, Bengaluru - 560064
FIRST INTERNAL ASSESSMENT TEST, November-2024
num1=0
num2=1
for i in range(2,n):
num1,num2=num2,num2+num1
print(num2,end=" ")
OR
Continue statements:
o The continue keyword is used to end the current iteration in a for loop (or a while
loop) and continues to the next iteration. It is used inside the loop.
o When the program execution reaches a continue statement, the program execution
immediately jumps back to the start of the loop and reevaluates the loop’s condition.
4b
sum=0
while True: —-------- 4marks + 1mrk(o/p)
n=int(input("enter the value:"))
if n>=0:
sum+=n
elif n<0:
break
else:
print("invalid input")
iii) n= 10
n value after check 10
iv) Error : name n is parameter and global
OR
6.a print("cats","dogs","mice",end=" ") 2M CO2,K3
print("cats","dogs","mice",sep=",") +
return statement definition and one example 2M
=4M
6.b try:
a=int(input("enter the value of a"))
b=int(input("enter the value of b"))
result = a/b 6M CO2,K3
except ValueError as e:
print(e)
except ZeroDivisionError as e:
print("An exception occurred:", e)
BMS INSTITUTE OF TECHNOLOGY AND MANAGEMENT
Avalahalli, Doddaballapura Main Road, Bengaluru - 560064
FIRST INTERNAL ASSESSMENT TEST, November-2024
7. regNum = 0 10 M CO3,K4
nameList = []
usnList = [] Main
usn='' :3
def addStudents():
if(len(usnList)<3): addS
name = input("Enter name :") tuden
nameList.append(name) ts:2
global regNum
regNum = regNum + 1 view
l = len(str(regNum)) Stud
if(l == 1): ents :
2
usn = "1BY24CS"+"000"+str(regNum)
elif(l == 2): Find
usn = "1BY24CS" + "00" + str(regNum) Num
elif (l == 3): ber
usn = "1BY24CS" + "0" + str(regNum) of
else: stude
usn = "1BY24CS" + "0" + str(regNum) nts 1
usnList.append(usn)
else:
print("Class is full.") displ
def viewStudentsDetails(): ayNa
print("Name USN") me :
for i in range(len(usnList)): 2
print(nameList[i]," ",usnList[i])
def findNumberOfStudents():
print("Number of students : ",len(usnList))
def displayName():
usn = input("Enter USN :")
print("Name of the student for usn as :",usn," is
",nameList[usnList.index(usn)])
def main():
while(True):
print("\nEnter 'a' to append,"
"'v' to view, "
"'f' to find class strength"
"'d' to display the name"
"'e' to exit the program")
choice = input()
if choice == 'a':
addStudents()
elif choice == 'v':
viewStudentsDetails()
elif choice == 'f':
findNumberOfStudents()
BMS INSTITUTE OF TECHNOLOGY AND MANAGEMENT
Avalahalli, Doddaballapura Main Road, Bengaluru - 560064
FIRST INTERNAL ASSESSMENT TEST, November-2024
b. Statement X: 4 times
Statement Y: 1 times X
2 printi
list = [2, 1] ng :
33 1
list = [2, 1] Y
135 Printi
list = [2, 1, 1, 3] ng :1
28 List
list = [2, 1, 1, 3, 2, 2] printi
10 ng :
Sum = 14 1
Sum
:1
Bloom’s Category
Remembering (K1) Understanding (K2) Applying (K3) Analyzing (K4) Evaluating (K5) Creating (K6)