Professional Documents
Culture Documents
User Input First Half and Second Half
User Input First Half and Second Half
import math
length_str = input("Enter a string at least two.")
if(len(length_str) < 2) :
print("Please enter a string of at least two.")
length_str = input("Enter a string at least two.")
if len(length_str)%2 == 0:
middle = math.floor(len(length_str)/2)
first_piece = length_str[: middle].upper()
second_piece = length_str[middle :].lower()
print(first_piece + second_piece)
else :
middle = math.floor(len(length_str)/2)
first_piece = length_str[: middle].upper()
second_piece = length_str[middle : ].lower()
print(first_piece + second_piece)
Example Output :
Enter a string at least two.
aabbcdd
AABbcdd