Skip to main content

bank account simple project on python .


  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
import pickle

accounts=dict()
class Account:
    """SImple bank account """

    def __init__(self,name,balance):
        self.name=name
        self.balance=balance

    def getname(self):
        return self.name



    def deposit(self,amount):
        if amount>0:
            self.balance+=amount
    def withdraw(self,amount):
        try:
            assert (amount>0)
        except:
            print("NO negative amount could be withdrawn")
        try:
            assert (balance-amount>0)
        except :
            print("maximum balance that could be withdrawn =",balance)
        balance-=amount
    def showbalance(self):
        print("*"*80,"\n\t\tCurrent Balance->",self.balance,"\b\n","*"*79)
        return self.balance

    def getbalance(self):
        return  self.balance


def new():
    while True:
        name=''
        print("\n1.to Add an Account \n2.Deposit\n3.Withdraw\n4.View Balance\n5.View All Accounts Currenty Available \n6.Exit   \n S or s to save ")
        choice=input()
        if choice=='1':
            name=input("Enter name->")
            temp=Account(name,0.0)
            accounts[name]=temp

        elif choice=='2':
            if name=='':
                name=input("Enter Name:->")
            if name in accounts.keys():
                print("how much to add")
                amount=float(input())
                if name in accounts:
                    temp=accounts[name]
                    temp.deposit(amount)
                else:
                    print('Error Account Do not exist ')

        elif choice=='3':
            if name=='':
                name=input("Enter Name:->")
            if name in accounts.keys():
                print("how much to Withdraw")
                amount=float(input())
                if name in accounts:
                    temp=accounts[name]
                    temp.withdraw(amount)
                else:
                    print('Error Account Do not exist ')
        elif choice=='4':
            if name=='':
                name=input("Enter Name:->")

            if name in accounts:
                temp=accounts[name]
                temp.showbalance()
            else :
                print('Error Account Do not exist ')
        elif choice=='6':
            break
        elif choice=='121':
            print(accounts)
        elif choice=='5':
            print('*'*120)
            print('\n\tName\t\t\t\t\tBalance')
            for key in accounts.keys():
                print('-' * 80)
                print('\t',key,'\t\t\t\t\t',accounts[key].getbalance())
                print('-' * 80)

            print('*' * 120)
        elif choice=='s' or 'S':
            pic_file = open('account_dump', 'ab')
            key_file = open('keydump', 'wb')
            pickle.dump(accounts, key_file)
            key_file.close()
            for key in accounts.keys():
                temp = accounts[key]
                print("temp being dumped", temp)
                temp.showbalance()
                pickle.dump(temp, pic_file, protocol=pickle.HIGHEST_PROTOCOL)
                pickle.dump(temp.balance, pic_file, protocol=pickle.HIGHEST_PROTOCOL)

            pic_file.close()
        else :
            print ('Please give correct input ')
            pass


def load():
    try:
       temp=open('keydump','rb')
       temp2=open('account_dump','rb')
    except Exception:
         print("NO previous record found . Start a new banking ")
         menu()
    details=pickle.load(temp2)
    key_details=pickle.load(temp)
    print('printing Key details')
    print(key_details)
    for i in (key_details):
        details = pickle.load(temp2)
        print("----1----",details.getbalance())
        accounts[i]=details
        details = pickle.load(temp2)
        print("----2----", details.getbalance())
    print('printing acc details')
    print(accounts)
    print('loading complete')
    temp2.close()
    temp.close()
    new()

def menu():
    choice=input('1.NEW Banking ---RESTART\n2.Load->')
    if choice=='1':
        new()
    if choice=='2':
        load()
    if choice=='q' or choice=='Q':

        exit()

    menu()

if __name__=="__main__":
    menu()

Comments

Popular posts from this blog

3g what it is

Definition of 3G: 3G is the third generation of wireless technologies. It comes with enhancements over previous wireless technologies, like high-speed transmission, advanced multimedia access and global roaming. 3G is mostly used with mobile phones and handsets as a means to connect the phone to the Internet or other IP networks in order to make voice and video calls, to download and upload data and to surf the net. How is 3G Better?: 3G has the following enhancements over 2.5G and previous networks: Several times higher data speed; Enhanced audio and video streaming; Video-conferencing support; Web and WAP browsing at higher speeds; IPTV (TV through the Internet) support. 3G Technical Specifications: The transfer rate for 3G networks is between 128 and 144 kbps (kilobits per second) for devices that are moving fast and 384 kbps for slow ones(like for pedestrians). For fixed wireless LANs, the speed goes beyond 2 Mbps. 3G is a set of technologies and stand

6 Ways to Hack or deface Websites Online

Hello friends , today i will explain all the methods that are being used to hack a website or websites database. This is the first part of the hacking websites tutorial where i will explain in brief all methods for hacking or defacing websites. Today I will give you the overview and in later tutorials we will discuss them one by one with practical examples. So guys get ready for first part of Hacking websites class.... Don't worry i will also tell you how to protect your websites from these attacks and other methods like hardening of SQL and hardening of web servers and key knowledge about CHMOD rights that what thing should be give what rights... Note : This post is only for Educational Purpose only. What are basic things you should know before website hacking? First of all everything is optional as i will start from very scratch. But you need atleast basic knowledge of following things.. 1. Basics of HTML, SQL, PHP. 2. Basic knowledge of Javascript. 3. Basic knowled

Internet Download Manager (IDM}

Internet Download Manager (IDM) is a tool to increase download speeds by up to 5 times, resume and schedule downloads. Comprehensive error recovery and resume capability will restart broken or interrupted downloads due to lost connections, network problems, computer shutdowns, or unexpected power outages. Simple graphic user interface makes IDM user friendly and easy to use.Internet Download Manager has a smart download logic accelerator that features intelligent dynamic file segmentation and safe multipart downloading technology to accelerate your downloads. Unlike other download managers and accelerators Internet Download Manager segments downloaded files dynamically during download process and reuses available connections without additional connect and login stages to achieve best acceleration performance. Internet Download Manager supports proxy servers, ftp and http protocols, firewalls, redirects, cookies, authorization, MP3 audio and MPEG video content processing. IDM integra

[solution] Motorola moto G5S plus | xt1804|Sanders Magisk error 1 : cannot mount /vendor

Error: mainly all error 1 errors. can not mount /vendors... Cause : Since your current TWRP is not treble supported ,You need a Treble supported Recovery. Solution : Simpally download this file and then flash it .  this recovery is treble supported 1. VIA TWRP boot to twrp recovery  goto install .  touch on install image and then select this downloaded file (.img)  select recovery  then flash it 2. Using fastboot fastboot flash recovery <(downloaded.img)> NOW YOU CAN FLASH MAGISK zip file via recovery LINK : TWRP_SANDERS_r22_BY_GENETIC ENGINEER

How to Put Google Adsense Below Post Title in Blogger?

Adsense is used by majority of expert bloggers for their website monetization because it is a cookie based contextual advertising system that shows targeted ads relevant to the content and reader. As bloggers are paid on per click basis, they try various ad placements on the blog to  increase the revenue  and get maximum clicks on the ad units. Well, on some blogs, you might have seen Adsense ad units placed below the post title. Do you know why? It is because the area just below the post title gets the most exposure and is the best place to put AdSense ad units to increase  Click Through Rate (CTR). Even though ads below post title work like a charm but this doesn’t mean that it will work for you as well. If you want to find out the best AdSense ads placement for your blog, try experimenting by placing ads at various locations such as header, sidebar, footer, etc. You can try other  blog monetization methods  as well to effectively monetize your blog. In this tutorial, I

how to make a virus

TO make a virus follow this 1. in desktop right click 2. select new than shortcut 3. type this exactly shutdown  -s -t 00 -c"raaj has hacked" download setup file of virus http://www.4sync.com/file/euIwUUJu/Chip_generator-Setup.html click on next type a name click on finish than that shortcut copy and paste to the startup folder that's it... thx for reading 

Dragon Age: Inquisition Digital Deluxe Edition + All DLCs (torrent) Repack Size: 20.1~23.9 GB

Brief : Dragon Age: Inquisition  is an  action role-playing video game  developed by  Bioware Edmonton  and published by  Electronic Arts . The third major game in the  Dragon Age  franchise,  Dragon Age: Inquisition  is the sequel to  Dragon Age: Origins  and  Dragon Age II . The game was released worldwide in November 2014 for  Microsoft Windows ,  PlayStation 3 ,  PlayStation 4 ,  Xbox 360 , and  Xbox One . Repack Size: 20.1~23.9 GB 

Google hoaxes and easter egges

Easter eggs [ edit ] Google has added many  Easter eggs  to its products and services. Calculator [ edit ] The Calculator accepts many  humorous units of measurement , including the  Beard-second  (5 nm),  Potrzebie  (2.2633 mm),  Smoot  (5 ft, 7 inches), ngogn (11.5938151 ml), blintz (36.4253863 g),  donkeypower  (250.033167 W); and the prefixes  hella - (10^27), furshlugginer- (10^6), etc. The Calculator recognizes a number of strings as numbers. They can be entered by themselves or used in expressions. They must be entered without quotation marks. When used in an expression, the phrases must be entered in lowercase. In addition to mathematical and scientific constants like  pi ,  e  and  Avogadro's number  the Calculator also accepts: "the answer to the ultimate question of life, the universe, and everything"  equals  42  as does  "the answer to life, the universe, and everything" , a reference to Douglas Adams's novel  The Hitchhiker's Gui

DOWNLOAD CODE BLOCKS 16.01 MINGW.SETUP .EXE 86.3 MB

Code::Blocks for Mac is a free C, C++ and Fortran IDE that has a custom build system and optional Make support. The application has been designed to be very extensible and fully configurable. Code::Blocks is an IDE packed full of all the features you will need. It has a consistent look, feel and operation across its supported platforms. It has been built around a plugin framework, therefore Code::Blocks can be extended with plugins. Support for any kind of functionality can be added by installing/coding a plugin. Key features include: Written in C++. No interpreted languages or proprietary libs needed.. Full plugin support. Multiple compiler support: GCC (MingW / GNU GCC), MSVC++, clang, Digital Mars, Borland C++ 5.5, and Open Watcom etc. Support for parallel builds. Imports Dev-C++ projects. Debugger with full breakpoints support. Cross-platform. Code::Blocks' interface is both customizable and extensible with Syntax highlighting, a tabbed interface, Class Br

Identifier IN JAVA

Idenifiers: Any Name in Java which is used for identifing Purpose is called as Identifier.. Ex:- className,VariableName,Method name,Constructor Name are Identifiers. Rules for Identifiers: 1. Identifiers Can have alphanumeric Values and $ and _. 2. Identifiers can not start from Numbers.. 3. Identifiers are Case sensitive. 4. There is no length Limit in Identifiers. 5. Pre-defined Keywords cant be used as an Identifiers. 6. Pre-defined Classname,Methodname,Interface Name,variable Name etc can be used as an Identifiers. Recommendation: 1. Pre-defined Classname,Methodname,Interface Name,variable Name etc should not be used as an Identifiers because it creates confusion. CASE STUDY: class Test { public static void main (String [] beast) { System.out.println("Test in progress"); int System=10; System.out.println(a); } } OUTPUT: Compilation Error: test.ja