RE: where is it 06-18-2014, 02:40 PM
#24
Lol, thanks @bluedog.tar.gz.
I'm happy that Python finally seems to be running smoothly on your system. That's great. As for which version to use, I'll recommend Python 3.4. Python 3.x is the future, hence no reason to learn an already deprecated version(s). Also, if you were to go back and code in 2.x it will be easier when you already know 3.x. The trip from 2.x to 3.x is harder than 3.x to 2.x.
1. Variable naming. Please try to use describing variable names. Pick names which gives an idea about what kind of information/value the variable holds.
2. Python uses indentation, which is why your function is not ran. You put our function call inside your function, how would python know, how to run the function, when it doesn't get a call to it?
3. You use string concatenation, that's generally a bad practice and string formatting is highly recommended. I'll give you an example of how I would have wrote your code.
Don't mind the backslashes, the syntax highlighting script is apparently inserting escape characters...
I'm happy that Python finally seems to be running smoothly on your system. That's great. As for which version to use, I'll recommend Python 3.4. Python 3.x is the future, hence no reason to learn an already deprecated version(s). Also, if you were to go back and code in 2.x it will be easier when you already know 3.x. The trip from 2.x to 3.x is harder than 3.x to 2.x.
1. Variable naming. Please try to use describing variable names. Pick names which gives an idea about what kind of information/value the variable holds.
2. Python uses indentation, which is why your function is not ran. You put our function call inside your function, how would python know, how to run the function, when it doesn't get a call to it?
3. You use string concatenation, that's generally a bad practice and string formatting is highly recommended. I'll give you an example of how I would have wrote your code.
Code:
def greet_user():
name = input('Please enter your HC username: ') # The user is asked to enter his HC username.
print ('Welcome to HackCommunity, {!s}.'.format(name)) # We use string formatting to display a nice welcome message.
greet_user() # The function get's called. Notice how it's placed outside the function.Don't mind the backslashes, the syntax highlighting script is apparently inserting escape characters...

![[+]](https://sinister.li/images/modern/collapse_collapsed.png)