LAB EXPERIMENT No 4 Solve

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 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