Error 1: Don't confuse yourself with Caps and Smalls. If you have used a function
Full_name(), then call
full_fame() and not
Full_name.
Similarly, if you use a variable
first, then use
first everywhere for it and not
First.
Error 2: Indent your code properly.
Look where your code calls the full_name function. Its inside the function block itself [Recursive function?]
Remove the whitespace before the full_name() function call to pull it away from the function block.
Here is the correct code:
Code:
def full_name():
first = input('enter first name: ')
last = input('last name here: ')
print first + last
full_name()
And you got to use def instead of Def.
Then you have to use the print function to get the output on screen. You did not print the values, you just used
Return.
Now, the output:
Quote:enter first name: Alok
last name here: Sharma
AlokSharma <----- the output
So, the space between first and last name is missing. So, we will use a better code.
Code:
def full_name():
first = input('enter first name: ')
last = input('last name here: ')
print "%s %s" % (first,last) #The first %s is replaced by the value of first variable in braces [first] and the second one with [last] ans the space in between.
full_name()
Now this gives out the following Output:
Quote:enter first name: Alok
last name here: Sharma
Alok Sharma <----- a better output
Now, something more better:
Code:
def full_name():
first = input('enter first name: ')
last = input('last name here: ')
print "Dear %s %s, Welcome to Hackcommunity!" % (first,last)
full_name()
Now this gives out the following Output:
Quote:enter first name: Alok
last name here: Sharma
Dear Alok Sharma, Welcome to Hackcommunity! <----- a far better output
Best of luck.