AI Features

Hands-On Coding II

Get some hands-on practice with the concepts we have learned so far.

In this project lesson, we will use the knowledge about Python we have gained so far and make an ATM system for a single person. The ATM will contain the following functions:

  1. Balance check

  2. Cash deposit

  3. Cash withdrawal

Defining the main function

It is a good idea to define the main() function in the early stages of the project, as it allows us to build the project in a modular, easy-to-follow, and easy-to-fix manner. Let's start off by defining the main() function and populating it with the required variables. No worries if we define all of the variables required for the project; we can just define the ones that we can think of right now and later add new ones if required.

For the ATM system that contains data for a single person, we need to define the name of the person, their account balance, and a PIN for security. Please define the main() function in the space provided below and define the required variables. ...

def main(): # Definfing the main function.
  # Define the required varaibles here.
  
  print("Program ended.") # A message for when the program ends.

main() # Calling the main function to initialize the program.
Defining the main() function and populating it with the required variables

Verify the user

Now that we have saved the username and a PIN corresponding to it, we can ...

Ask