Python Forum
Need help with pseuo -bank account using OOP
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need help with pseuo -bank account using OOP
#11
(Jul-08-2017, 10:42 PM)ichabod801 Wrote: You are still just checking one at a time. That is not going to solve the problem. You need to get the pin from the user, and then find the account that the pin matches. You are getting the account, getting the pin from the user, and seeing if it matches that account. Then you're saying it's an error when it doesn't match that particular account, even if they entered a valid pin for another account.

In my data dictionary, the keys (1, 2, 3) are the pins. By using pin in data I check that the pin they entered is any valid pin, and only give them an error if their pin doesn't match any account. Then I give the "account" (in this case a string) to the inner loop and let the user do things with it.
text = data[pin]
while True:
index = int(input('index? '))
if index < 0:
break
else:
print(text[index])
elif pin[0] not in 'qQ':
print('Invalid pin.')
else:
break
Can you explain your code line by line please still a bit confused on how it works. Also how will I be able to link this piece of code to the rest of my own
Reply


Messages In This Thread
RE: Need help with pseuo -bank account using OOP - by obieze998 - Jul-08-2017, 11:20 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Different results of code with local account and technical account dreyz64 7 3,743 Mar-05-2020, 11:50 AM
Last Post: dreyz64

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020