Lab report 6
Fall 2021
CSE422L Data Analytics Lab
Submitted by: Ayaz Mehmood
Registration No.:18PWCSE1652
Section: A
“On my honor, as student of University of Engineering and Technology, I have
neither given nor received unauthorized assistance on this academic work.”
Student Signature: ______________
Submitted to:
Engr. Mian Ibad Ali Shah
Last date of Submission:
11 February 2022
Department of Computer Systems Engineering
University of Engineering and Technology, Peshawar
OBJECTIVE:
The basic Objective of this lab is:
To know python basics
To learn and code different task in python
TASKS
Task 1:
1) Using function, find all the multiplicative factors of a number provided as input.
Code + Output:
Task 2:
Create a library system for DCSE using dictionaries (must include Student's information,
Books information
Code+Outputs:
List of Books and Semester Student Dictionary:
Student Registration in Library function:
Student Registration cancel in Library function:
For that we need to check whether the student really exist or not that’s why another function is
been called from inside which is checkregister function
Borrowing a book from library function:
The details of book will be saved in borrowed book list variable for every semester student. We
have defined it for every individual student.
Returning a book to library:
After returning it to library the book will be deleted from the list of borrowed list.
Home Screen Code:
Registering myself:
Borrowing a book from library:
Checking:
Registration done and DA book is been added in the borrowed list too:
Returning a book:
Checking:
Deregister from Library:
Checking:
Empty list because I have deregistered my self
Task 3:
Using functions, create an ATM system.
Code:
#Using functions, create an ATM system.
def ATM():
pinCode = ["1234", "1122", "2233", "3344"]
accountHoldersName = ["Ayaz", "Ayaz mhmd", "ayz mhmd", "ayz"]
accountNumber = ['1652', '16522', "1653", "16523"]
balance = [570000, 230000, 41000, 83331]
while(1):
print("\t\t------- Welcome-------")
inputPin = input("\nEnter Pin Number: ")
index=0
for pin in pinCode:
if pin == inputPin:
break
index=index+1
print("\nYour account number is: ",accountNumber[index])
print("Your account balance is: Rs.", balance[index])
while(1):
drawOrDeposite = input("\nDo you want to withdraw or deposit cash
(withdraw/deposite/no): ")
if drawOrDeposite == "withdraw":
amount = input("\nEnter the amount you want to withdraw: ")
try: #Exception handling
amount = int(amount)
if amount > balance[index]:
raise
except:
print("invalid amount.")
else:
remainingBalalnce = balance[index] - amount #subtracting the drawed amount.
balance.remove(balance[index]) #removing the old ammount from the list and
adding the new list after draw.
balance.insert(index,remainingBalalnce)
print("\\t transaction successfull ")
print("\nYour available balance is: ",remainingBalalnce)
break
elif drawOrDeposite == "deposite":
amount = input("Enter the amount you want to deposite: ")
try:
amount = int(amount)
if amount > balance[index]:
raise
except:
print("invalid amount.")
else:
remainingBalalnce = balance[index] + amount #adding the deposited amount.
balance.remove(balance[index])#removing the old ammount from the list and
adding the new list after draw.
balance.insert(index,remainingBalalnce)
print("\\t Successfully deposit ")
availableBalance = print("Your available balance is: ",remainingBalalnce)
break
atm = input("\tEnter yes to contine the process and no to end ")
if atm=='yes':
break
else:
continue
print("\n\n\t\tThank you for using\n")
Output:
Successful Transaction:
Insufficient balance:
Wrong Pin:
Deposit money:
Task 4:
Design a calculator (+,-,*,/,pow) using functions
Code + Output:
All the functions definition:
Addition of two no:
Subtraction of two no:
Multiplication of two no:
Division of two no:
Power of two no: