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

13 websites to register your free domain

Register your Free Domain Now!! 1)  .tk Dot TK is a FREE domain registry for websites on the Internet. It has exactly the same power as other domain extensions, but it’s free! Because it’s free, millions of others have been using .TK domains since 2001 – which makes .TK powerful and very recognizable.  Your website will be like www.yourdomainname.tk . It is free for 1 year. It’s a ccTLD domain whixh having the abbreviation  Tokelau. To create a .tk domain, Visit   www.dot.tk 2) co.cc Co.cc is completely free domain which is mostly used by blogspot bloggers because of it’s easy to use DNS system. Creating a co.cc for blogger is simple ( for instructions- “click here”). Your website will be like www.yourdomainname.co.cc . To create a .co.cc domain, visit www.co.cc 3)   co.nr co.nr is too like co.cc. Your website will be like  www.yourdomainname.co.nr . You can add it for blogger also.. To create a .co.cc domain, vi...

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 y...

C++ Program to Find HCF and LCM among 4 numbers (Easiest Logic)

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 #include <iostream> #include <math.h> using namespace std; int main () { int a,b,c,d,i,j,minimum; cout << "Enter the all four number " ; cin >> a >> b >> c >> d; if (a < b && a < c && a < d) minimum = a; else if (b < c && b < d) minimum = b; else if (c < d) minimum = c; else minimum = d; for (j = minimum;; -- j) { if (a % j == 0 && b % j == 0 && c % j == 0 && d % j == 0 ) { break ; } } for (i = 1 ;;i ++ ) { if (i % a == 0 && i % b == 0 && i % c == 0 && i % d == 0 ) break ; } cout << "Lowest Common factor=>" << i << endl; ...

USE any TRIAL SOFTWARE FOREVER WITHOUT SERIAL NUMBER

USE any TRIAL SOFTWARE FOREVER WITHOUT SERIAL NUMBER(most wanted trick) Run a trial software forever now with time stopper you can run a trial software forever no need to fetch for serial numbers,activation codes,patch just DOWNLOAD TIME STOPPER now open it install it click browse select the .exe of the software or file which you want to run forever now simply click create desktop icon and now delete all its existing shortcuts now have fun enjoying software for life time

50 intesting facebook facts

some facts about facebook if u type @[4:0] in any facebook comment box it will write mark zukerburg 1 in every 13 people on Earth is on Facebook 35+ demographic represents more than 30% of the entire user base 71.2 % of all USA internet users are on Facebook In 20 minutes 1,000,000 links are shared on Facebook In 20 minutes 1,484,000 event invites are posted In 20 minutes 1,323,000 photos are tagged In 20 minutes 1,851,000 status updates are entered In 20 minutes 1.972 million friend requests are accepted In 20 minutes 2,716,000 photos are uploaded In 20 minutes 2,716,000 messages are sent In 20 minutes 10.2 million comments are posted In 20 minutes 1,587,000 wall posts are written 750 million photos were uploaded to Facebook over New Year’s weekend 48% of young Americans said they found out about news through Facebook 48% of 18 to 34 year olds check Facebook right when they wake up 50% of active users log on to Facebook in any given day Average user has 130 friends ...

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...

Is your Nokia Cell Phone Original

Nokia is one of the largest selling phones across the globe. Most of us own a Nokia phone but are unaware of it’s originality. Are you keen to know whether your Nokia mobile phone is original or not? Then you are in the right place and this information is specially meant for you. Your phones IMEI (International Mobile Equipment Identity) number confirms your phone’s originality. Press the following on your mobile *#06# to see your Phone’s IMEI number(serial number).   Then check the 7th and 8th numbers Phone serial no. x x x x x x ? ? x x x x x x x IF the Seventh & Eighth digits of your cell phone are 02 or 20 this means your cell phone was assembled in Emirates which is very Bad quality IF the Seventh & Eighth digits of your cell phone are 08 or 80 this means your cell phone was manufactured in Germany which is fair quality   IF the Seventh & Eighth digits of your cell phone are 01 or 10 this means your cell phone was manufactured in Finland whic...

HOW TO SEND FAKE SMS

..click on the photo to go smsglobal.com. Hey Guyss !! Today am going to tell you about an interesting site which enables to send free unlimited fake sms with any sender id mean From Any Mobile Number.You just have to register to the site and you will get 25 free sms.Now you get an idea that after completion of 25 sms you can sign up with new E-mail ID and get 25 more Yeah,you are right you can do that.Its a great site with many features other than sending free sms to any number with fake any id(Number) . And one of its important feature is that it sends messages/sms without any Advertisement in the message.As most of the sites do like ways2sms,160by2 etc .So,the receiver will get the sms as it sent from the mobile.Check the last image in this post to know how receiver will get your message Features:  Enable sending of free sms from Web to Mobile and that’s easy in comparison of sending sms from mobile . Enable use of any sender id instead of your’s mobile number.[ l...

python program to Print Starting Series OF Indian Mobile Number for a State or operator or both

import requests import urllib.request import time from bs4 import BeautifulSoup as bs import re url = ' https://en.wikipedia.org/wiki/Mobile_telephone_numbering_in_India' state_to_extract = "UE" #if set to None all state is considered telecom_to_extracted = None #if set to none all operator from particular city is extracted response = requests . get(url) print (response) soup = bs(response . text, "html.parser" ) one_a_tag = soup . findAll( 'tr' )[ 35 :] lst = [] for k in one_a_tag: s = k . findAll( 'td' ) limit = len (s) i = 0 while True : if i == limit: break no = s[i] . text i += 1 if i == limit: break operator = s[i] . text i += 1 if i == limit: break state = s[i] . text i += 1 if i == limit: break res = f "{no} {operator} {state}" if state_to_extract is None : if telecom_to_extracted is None : lst . append(no) elif telecom_to_e...