DEV Community

Iszyk
Iszyk

Posted on

Building My First Python Project (ATM): What I Learned From a Simple Project

When I started learning Python, I knew the basics: variables, data types, strings, numbers, conditionals, functions, and scope.
But knowing the syntax and actually using it to build something are two different things.
So I decided to build a Simple ATM program using only the concepts I had learned so far.

The goal wasn't to build a real banking system. It was to take the fundamentals I had learned and put them together into something practical.
And honestly, this small project taught me more than simply reading about Python syntax.

I wanted the program to have three basic options:

1. Withdraw
2. Deposit
3. Check Balance

Choose an option: 1

How much do you want to withdraw? 2000

Withdrawal successful!
Your remaining balance is: 8000 CFA
Enter fullscreen mode Exit fullscreen mode

1. Starting with Variables
The first thing I needed was a starting balance. This looks very simple, but it represents something important: variables allow programs to store information that can change.
The balance can change after a withdrawal or deposit.
For Example:

balance = 10000
balance -= 2000
Now the balance is 
8000
Enter fullscreen mode Exit fullscreen mode

2. Getting Input From the User
The ATM needs to interact with the user.
I used Python's input() function. One thing I learned here is that input() returns a string.
That's why when asking for a withdrawal amount, I used:

option = input('Choose an option: ')
withdrawal = int(input('How much do you want to withdraw? '))
Enter fullscreen mode Exit fullscreen mode

3. Using Conditional Statements
The ATM needs to know what the user wants to do.
That's where if, elif, and else come in.

if option == '1':
    # Withdraw

elif option == '2':
    # Deposit

elif option == '3':
    # Check balance

else:
    print('Invalid Option!')
Enter fullscreen mode Exit fullscreen mode

This was one of the most important parts of the project.
The program is essentially making decisions:
If the user chooses 1, do this.
If the user chooses 2, do that.
If the user chooses 3, show the balance.
Otherwise, tell them the option is invalid.

4. Creating Functions
Initially, I had most of my logic directly inside the program.
But I wanted to make the code more organized, so I created functions.
For withdrawals and deposits:

def withdraw_money(balance, withdrawal):
    if withdrawal <= balance:
        balance -= withdrawal
        return balance, True
    else:
        return balance, False


def deposit_money(balance, deposit):
    balance += deposit
    return balance
Enter fullscreen mode Exit fullscreen mode

This taught me that functions allow me to separate different responsibilities in my program. Instead of having all the withdrawal logic mixed with the menu logic, I can put the withdrawal logic inside its own function.

5. Understanding Parameters
My withdrawal function has two parameters:

def withdraw_money(balance, withdrawal):
Enter fullscreen mode Exit fullscreen mode

balance represents the current account balance.
withdrawal represents the amount the user wants to withdraw.

When I call the function:
balance, success = withdraw_money(balance, withdrawal)
I'm passing those values into the function.

6. Understanding return
This was probably the concept that challenged me the most.
At first, I was returning messages directly from my function:
return "Withdrawal successful!"
But then I realized that this would make my balance variable become a string instead of a number.
For example: balance = withdraw_money(balance, withdrawal) could make balance contain "Withdrawal Successful" instead of 8000. That would obviously cause problems when I wanted to perform another calculation.

So I changed the function to return the actual balance:

return balance, True

OR

return balance, False
Enter fullscreen mode Exit fullscreen mode

7. Returning Multiple Values
This was another new concept for me.
Python allows a function to return multiple values.

For example:

return balance, True
balance, success = withdraw_money(balance, withdrawal)

So if the withdrawal succeeds:
balance = 8000
success = True

And if it fails:
balance = 10000
success = False

I can the use the boolean value:
if success:
    print("Withdrawal successful!")
else:
    print("Insufficient funds!")
Enter fullscreen mode Exit fullscreen mode

This helped me understand how functions can perform an operation and communicate the result back to the main program.

8. My Final ATM Program

My Final ATM Program

This Project Taught Me That
Before building, I had to understand the individual concepts.
But putting them together helped me understand how they work as a system.

I practiced:

Variables
Strings
Integers
Type conversion
User input
Arithmetic operators
Conditional statements
Functions
Function parameters
Scope
Return values
Boolean values
Returning multiple values
Basic program structure

Most importantly, I learned that building projects exposes gaps in your understanding.
There were several moments where I knew the syntax but wasn't sure how to connect everything together.
That's actually one of the reasons I think projects are so important when learning to program.

You don't just learn:
"What does return mean?"
You learn:
"Why do I need return here?"
And that's a much deeper understanding.

What's Next?

This ATM is still very basic.
There are plenty of things I could add later:

Multiple transactions
PIN authentication
Transaction history
Account numbers
Transfer functionality
Input validation
Error handling
Loops so the ATM doesn't terminate after one operation
Saving account information

But I intentionally didn't add those features yet.
I'm still building my Python fundamentals, so I'm focusing on understanding one concept at a time.
The next step is to keep building small projects and gradually introduce new concepts.

Thanks for staying with me till the end

Top comments (0)