Python Case Matching Input and Output
<p>I'm doing the pig latin question that I'm sure everyone here is familiar with it. The only thing I can't seem to get is matching the case of the input and output. For example, when the user enters Latin, my code produces <code>atinLay</code>. I want it to produce <code>Atinlay</code>.</p>

<pre><code>import string

punct = string.punctuation
punct += ' '
vowel = 'aeiouyAEIOUY'
consonant = 'bcdfghjklmnpqrstvwxzBCDFGHJKLMNPQRSTVWXZ'

final_word = input("Please enter a single word. ")
first_letter = final_word[:1]

index = 0

if any((p in punct) for p in final_word):
    print("You did not enter a single word!")
else:
    while index &lt; len(final_word) and (not final_word[index] in vowel):
        index = index+1
    if any((f in vowel) for f in first_letter):
        print(final_word + 'yay')
    elif index &lt; len(final_word):
        print(final_word[index:]+final_word[:index]+'ay')
</code></pre>

<p>simply use the built in string functions.</p>

<pre><code>s = "Hello".lower()
s == "hello"
s = "hello".upper()
s == "HELLO"
s = "elloHay".title()
s == "Ellohay"
</code></pre>

python string