Giter VIP home page Giter VIP logo

py_atm-machine's Introduction

Py_ATM-Machine

Table of Contents

  1. ATM Function Requirements
  2. Import Python Random Module
    • What does the random module/package do in Python?
  3. Create Class and Define Functions
    • What is a class?
    • How to define a function?
  4. Define the main() Function
  5. ATM Process Creation Using while True

ATM function requirements

The first step is to brainstorm what basic transactions are completed at an ATM?
Some of the function that one can complete at an ATM are given below:

  • Input user pin for authentication
  • Check account balance
  • Deposit funds
  • Withdraw funds
  • Create random generated transaction id
  • Account interest rate and Monthly accused interest rate

Import python random module

Ques. What does the random module/package do in Python?
Ans. The random module allows a program to create random numbers by using the random.randint() function.
import random

Create Class and Define function

Ques. What is a Class?
Ans. A class is used for creating objects. By creating objects, the objects have variables and a behavior that's associated with them. A class is created with the keyword class. Once the class is created, the object within the class will then be called the instance of the class.

Ques. How to define a function?
Ans. Now we take the requirements that we created from the above and create functions. We can define the functions to provide the given functionality of the program. The function blocks are started with def keywords and followed with the function name and parenthesis, such as def getId(self).

Define the main() function

We must create the main() function because it’s only executed when the Python program is executed. Also, we could import a Python program as a module, but the main() method will not execute. The entry point of any program is the main() function, but the interpreter of python will execute the source file code sequentially. In addition, it will not call any method if it’s not within the code. This is why the main() method has a technique, so that the main() method will be executed when the program is executed directly and not when the module is imported.

By creating the main() method, we will use a range to have all users to enter a 4-digit pin to access their account.

ATM Process Creation Using while True

We will use the while True loop because it will loop forever. The while statement will take an expression and execute the body of the loop while the expression is equal to ‘boolean’ of True. As long as the loop stays True, the loop will indefinitely loop.

py_atm-machine's People

Contributors

jenilgajjar20 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.