RE: where is it 06-18-2014, 02:31 PM
#21
You said the problem is solved hence I am closing this thread
| where is it filter_list | |
(06-18-2014, 02:23 PM)root@localhost Wrote:(06-18-2014, 02:22 PM)Hatemind Wrote:(06-18-2014, 02:02 PM)root@localhost Wrote:(06-18-2014, 02:00 PM)chmod Wrote: Then it would appear that Python is working correctly. I think the problem is with your code. My Python is a little rusty so perhaps @Ex094 or even @Anima Templi would be in a better position to help, but from the looks of it the function is not being used correctly try something like
Code:welcome = raw_input('welcome to hackcommunity ') lol = raw_input('This is just a test ') def hack_community(welcome, lol): print welcome + " " + lol hack_community(welcome, lol)
running this gives the following output:
Code:welcome to hackcommunity hi This is just a test ok hi ok
Nope, says it has a syntax error
CHeck the indentation, and also you may need to use input instead of raw_imput, depending on your version of python. also, ints and strs don't concatenate, so you may have to use the str function to do so.
The error was on
Code:print welcome + " " + lol
@chmod Updated it
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.