help pls! - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: help pls! (/thread-29429.html) |
help pls! - dirtdude - Sep-01-2020 uncomfirmedusers = ['bob','joe','mikey'] comfirmedusers = [] while uncomfirmedusers: currentuser = uncomfirmedusers.pop() print("veryfing user: " = currentuser()) comfirmedusers.append(currentuser) print("\nThe following users have been confirmed:") for comfirmedusers in comfirmedusers: print(comfirmedusers.title()) everytime i compile this,this line print("veryfing user: " = currentuser()) it says you cant use a keyword for an expression im confussed,please help RE: help pls! - micseydel - Sep-01-2020 Going forward: Make your subject line descriptive. Use code tags. Post the full traceback, not just one line from it. As for your question, I didn't try running the code, but anything like "string" = function_call()isn't gonna work. What do you intend for such lines to do? I see two of them. RE: help pls! - deanhystad - Sep-01-2020 print is a function. When you call a function the arguments are separated by commas, not '='. currentuser is not defined as a function anywhere. Since it is not a function you cannot call it using currentuser(). print("veryfing user: " = currentuser()) # should be print("veryfing user:", currentuser)Though this does not cause a crash it is still a really bad idea: for comfirmedusers in comfirmedusers: print(comfirmedusers)Do not use the same name to refer both a list and an item in the list. When the above code completes the original list is gone. Instead do this: for user in comfirmedusers: print(user)confirmedusers is a list of strings. Well it would be if there weren't so many other errors. A list does not understand .title and doesn't know how to do .title(). You have one thing right. You are really confused. I think you need to start out with some simpler examples, or a few guided tutorials. You should also do some reading to understand the basics of the language. Not fun I know, but a lot better than the heaps of frustration heading your way otherwise. Good Luck. |