vendredi 3 mars 2017

How do I go about printing only the first letter of name in capslock along with the following?

a. Ask the user to enter their first name. The user may enter the name using uppercase or lowercase letters.

b. If the name starts with a vowel, print the message ‘Your name starts with a vowel.’; otherwise print the message ‘Your name starts with a consonant.’

c. Print the first letter of the name in uppercase, along with a suitable message. This part should be executed for all cases, whether the name starts with a vowel or consonant.

What I have done:

name = input('Enter your name:')
first = name[0]

if first == 'a' or 'e' or 'i' or 'o' or 'u':
print("Your name starts with a vowel")

else first
print("Your name starts with a consonant")

print('The first letter of your name is:', name.upper[0])

EXAMPLE OUTPUT

Aucun commentaire:

Enregistrer un commentaire