#TASK 01 PYTHON BASICS
Time shouldn’t exceed more
than 1.5 hrs
Objective:
Create an ATM system using OOP concepts, data types, operators, and
loops that allows users to:
• Check their balance
• Deposit money
• Withdraw money
This will test your understanding of classes, loops, conditions, and
mathematical operations.
Requirements:
1. Create a BankAccount class with attributes:
• account_number (string)
• account_holder (string)
• balance (float, default 0.0)
2. Methods in BankAccount class:
• check_balance(): Prints the current balance
• deposit(amount: float): Adds money to the balance
• withdraw(amount: float): Deducts money if sufficient balance is
available
• display_details(): Prints account details
3. Use loops and operators
• Use a while loop to keep the ATM running
• Use if-else for transaction validation
• Use arithmetic operators (+, -)
Expected Output Example
# Create an account
account = BankAccount("123456789", "John Doe", 1000)
while True:
print("\nATM Menu:")
print("1. Check Balance")
print("2. Deposit Money")
print("3. Withdraw Money")
print("4. Exit")
choice = int(input("Enter your choice: "))
if choice == 1:
account.check_balance()
elif choice == 2:
amount = float(input("Enter amount to deposit: "))
account.deposit(amount)
elif choice == 3:
amount = float(input("Enter amount to withdraw: "))
account.withdraw(amount)
elif choice == 4:
print("Exiting ATM. Thank you!")
break
else:
print("Invalid choice! Please try again.")
Expected Console Output
ATM Menu:
1. Check Balance
2. Deposit Money
3. Withdraw Money
4. Exit
Enter your choice: 1
Your balance is: $1000.0
ATM Menu:
1. Check Balance
2. Deposit Money
3. Withdraw Money
4. Exit
Enter your choice: 2
Enter amount to deposit: 500
$500.0 deposited successfully. New balance: $1500.0
ATM Menu:
1. Check Balance
2. Deposit Money
3. Withdraw Money
4. Exit
Enter your choice: 3
Enter amount to withdraw: 2000
Insufficient balance!
ATM Menu:
1. Check Balance
2. Deposit Money
3. Withdraw Money
4. Exit
Enter your choice: 4
Exiting ATM. Thank you!
Your Task:
• Implement the BankAccount class
• Use appropriate data types, operators, and loops
• Allow the user to perform multiple transactions until they exit