0% found this document useful (0 votes)
86 views6 pages

LAB EXPERIMENT No 4 Solve

The document describes a Python lab experiment on Python programming. The tasks involve installing Python in Ubuntu Linux, learning Python concepts through coding examples, and building a new project to demonstrate understanding. The document also includes sample Python code to create an ATM class with methods for creating a PIN, depositing, withdrawing, and checking the balance. The code takes user input for authentication and processing transactions and updating the account balance.

Uploaded by

Engr Shabir
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)
86 views6 pages

LAB EXPERIMENT No 4 Solve

The document describes a Python lab experiment on Python programming. The tasks involve installing Python in Ubuntu Linux, learning Python concepts through coding examples, and building a new project to demonstrate understanding. The document also includes sample Python code to create an ATM class with methods for creating a PIN, depositing, withdrawing, and checking the balance. The code takes user input for authentication and processing transactions and updating the account balance.

Uploaded by

Engr Shabir
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
You are on page 1/ 6

LAB EXPERIMENT # 03

Python for Robotics Programming

Name: Muhammad Shabir Lab Instructor Signatures:

Roll No: 19cs35 Date:27/09/2022

Task(s)

• Hands-on all the steps of Python Installation in Ubuntu Linux (mentioned in


prerequisite section of lab.
• Exercise all concepts of Python (Static and dynamic typing, Code indentation,
Variables conditional statement, Functions, Handling Exception, Classes,
Files, Modules ) through coding (Write, interpret and execute all Example
codes.)
• Attach all pics of the performed tasks.
Build a new project in Python to demonstrate your understanding of all above programming
concepts (Also use different libraries Machine Learning/Computer Vision in code).
class Atm:
def __init__(self):
self.pin=""
self.balance=0
self.menu()
def menu(self):
user_input=input('''
Hellow! how whould you like to proceed?
1.Enter 1 to create pin.
2.Enter 2 to deposit.
3.Enter 3 to withdraw.
4.Enter 4 to check_balance.
5.Enter 5 to exit.
''')
if user_input=="1":
self.create_pin()
elif user_input=="2":
self.deposit()
elif user_input=='3':
self.withdraw()
elif user_input=="4":
self.check_balance()
else:
print("bye")

def create_pin(self):
self.pin=input("set your pin :")
print("You create your pin successfully")
def deposit(self):
temp=input("Enter you are pin :")
if temp==self.pin:
amount=int(input("Enter your amount for depositing :"))
self.balance=self.balance+amount
print("Deposit successfully")
else:
print("Invalid pin")

def withdraw(self):
temp=input("Enter you are pin ")
if temp==self.pin:
amount=int(input("Enter amount for withdraw :"))
if amount<=self.balance:
self.balance=self.balance-amount
print("Operation successful")
else:
print("Insufficient balance")
else:
print("Invalid pin")

def check_balance(self):
temp=input("Enter you are pin")
if temp==self.pin:
print(self.balance)
else:
print("Invalid pin")
Shabir=Atm()
Shabir.deposit()
Shabir.withdraw()
Shabir.check_blance()

You might also like