In C# I would go:
string UserName;
string Password;
But now, in Python:
class User:
UserName
Password
I receive an error that UserName isn’t defined. Can I not declare a variable without a variable?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In Python, and many other languages, there is a value that means “no value”. In Python, that value is
None. So you could do something like this:Those sure sound like instance variables though, and not class variables, so maybe do this:
Note how Python assigns the
Nonevalue implicitly from time to time: