You are on page 1of 3

CIA 1

125004102
JAYASAKTHI S

1. -1.0
2. SAS10
3. (a)SASTRA
(b) or (Python is case sensitive) ans: True
4. (a) 1.234e^-4
(b)5*x**2
5. (a) Welcome To Python String Concepts
(b) print(s[11:17])
6. Hello, SASTRA
7. (a) False
(b) False
8. True
9. def check(s, c):
if c in s:
return True
Else:
return False
10. defined_string = "WELCOME TO SASTRA UNIVERSIY"
given_string = "SASTRA"
if given_string in defined_string:
print ("Found")
else:
print ("Not Found")
11.
Book.py

def readBookDetails():
ISBN = int (input("Enter ISBN Number: "))
author = input("Enter author name: ")
edition = int (input("Enter edition: "))
return ISBN, author, edition

Journal.py

def readJournalDetails():
ISSN = int (input("Enter ISSN Number: "))
publisher = input("Enter publisher name: ")
volume = int (input("Enter Volume No.: "))
return ISSN, publisher, volume

Common.py

from Book import readBookDetails


from Journal import readJournalDetails
def getDetails(L):
ctype = int(input("Enter type: 1-Book 2-Journal: "))
name = input("Enter Name : ")
year = int(input("Enter year of publication: "))
if ctype == 1:
ISBN, author, edition = readBookDetails()
L.append([ctype, name, ISBN, author, edition, year])
else:
ISSN, publisher, volume = readJournalDetails()
L.append([ctype, name, ISSN, publisher, volume, year])
def printDetails(item):
print("Name : ", item[1])
if item[0] == 1:
print("ISBN Number: ", item[2])
print("Author Name: ", item[3])
print("Edition: ", item[4])
else:
print("ISSN Number: ", item[2])
print("Publisher Name: ", item[3])
print("Volume: ", item[4])
print("Year of Publication: ", item[5])

main.py

from Common import getDetails, printDetails


L = []
for i in range(5):
getDetails(L)
for item in L:
printDetails(item)

12)

Convocation.py
def register(L):
regno = input("Enter Register Number: ")
email = input("Enter Email ID: ")
willing = int(input("Are you willing to attend convocation? (0-No/1-Yes)"))
L.append([regno, email, willing])
def getByProgramme(L, prg):
prg_list = [stu for stu in L if int(stu[0][3:6]) == prg]
return prg_list
def getStudentByRegno(L, regno):
r_stu = [stu for stu in L if stu[0] == regno]
return r_stu

Conv_main.py

from Convocation import register, getByProgramme, getStudentByRegno


L=[]
opt = 1
while opt <= 3:
print("1-Graduand Registration, 2-Programmewise Graduand List, 3-View a
Graduand")
opt = int(input("Enter your option: "))
if opt == 1:
register(L)
elif opt == 2:
prg = int(input("Enter Programme Code: 003-CSE, 014-ICT, 015-IT etc"))
p_list = getByProgramme(L, prg)
print(p_list)
elif opt == 3:
reg = input("Enter Register Number: ")
stu = getStudentByRegno(L, reg)
if stu:
if stu[0][2]:
print("Registered and willing to attend convocation")
else:
print("Registered, but not willing to attend convocation")
else:
print("Not Registered")

You might also like