Week 6 – 3/7/2015

In class we went over how to write a function for our hangman game that will take a word as an input and then return a string with the correct number of underscores. For example
“banana” ¬† —-> ¬†“_ _ _ _ _ _ _ _”
Now write a function that takes 3 inputs. First_Name, Middle_Name, and Last Name and returns a string which is the initials.
Lets call the function “Initials”
¬†Initials(“Michael”, “Zvi”, “Liebis”) —–> “MZL”
Some help:
if you have a string
x = “Michael”
x[0] is the first character or “M”
Test out this code:
def sum(x,y):
return x+y
s = sum(2,3)
print s

Leave a Reply