Reputation: 1
I want my function to print out the initials of each of the names. Eg: LeBron James would print LJ.
def names(first, last):
firstLetter = first[0]
secondLetter = last[0]
print(firstLetter + secondLetter)
names(LeBron, James)
names(Michael, Jordan)
names(Steph, Curry)
Upvotes: 0
Views: 39
Reputation: 194
I think you meant for your inputs to be strings!
names("LeBron", "James")
names("Michael", "Jordan")
names("Steph", "Curry")
The way you have it, Python is interpreting the parameters you pass in (ex. names(LeBron, James)
) as variables, but you don't have any variables that correspond to those names.
Upvotes: 1
Reputation: 11
Just now python thinking that Lebron e.t.c is variables. Fix:
names("LeBron", "James")
names("Michael", "Jordan")
names("Steph", "Curry")
Upvotes: 0