Nov-29-2018, 07:18 PM
Hi, thanks for the reply, I apologize as it does not need surrounding characters but the following two. Example, house would generate USE for the threeup. I found your other tips to be successful and thank you, however for line 5, it does not print the middle character but it prints the first character (when inputting "dog", it states that the middle character is "d".) Thanks for any help you can offer, below is the new code, I apologize in advance if I do not reply soon, as I have to leave my PC for a couple hours while I leave in around 10 minutes. Thanks in advance.
a = raw_input("Enter a Phrase: ") numb = len(a) mid = int(len(a) // 2) if numb == 3: mid = (len(a) // 2 - 1) threeup = a[mid - 1] + a[mid] + a[mid + 1] threelow = a[mid - 1] + a[mid] + a[mid + 1] if numb == 4: mid = int(len(a) // 2) else: threeup = a[mid] + a[mid + 1] + a[mid + 2] threelow = a[mid] + a[mid + 1] + a[mid + 2] print "There are " + str(numb) + " characters in this phrase" print "" + str(a[mid]) + " is the middle character" print threelow.lower() print threeup.upper()