I am making a program for my CS class. Is there a way, in python, to set more than one value to a variable? Am I thinking about this in the wrong way?

I need to make a program that asks a bank account holder for their username.

If that user name is in the the system it asks for the pin.
If not, it kicks them back a step

If the username and pin match then it displays their account details.
If not, again, it kicks them back a step

Any help would be greatly appreciated!

Recommended Answers

All 4 Replies

try to use classes :)

try to use classes :)

In the class I am going to create a variable called user_names.
Is is possible for a variable to have multiple values?
Example: user_name = lee, wes?

That idea is what I am stuck on. Is that possible?

Thanks

For example, use list.

user_names = []
user_names.append('User1')
user_names.append('User2')
print(user_names)
if user_names[0] == someuser:
    ....

There is many ways to reprecent group of information. Basic choice is list for changing data or tuple for rarely changing data. Tuple is faster but any change to it generates new tuple as it is immutable. Please go through the tutorials section on types.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.