2 Comments
User's avatar
Sidharth's avatar

def cal_num_of_characters_excluding_spaces(name):

l = name.split()

# print(l)

sum = 0

for ele in l:

sum = sum + len(ele)

return sum

name = input("Please enter your full name: ")

name = name.strip()

print("Your name in uppercase:", name.upper())

print("Your name in lowercase:", name.lower())

print("Total number of characters(excluding spaces): ", cal_num_of_characters_excluding_spaces(name))

print("Your name reversed: ",name[::-1] )

Expand full comment
VINOD VIJAYAN's avatar

I have done mine.

def string_manipulation():

name = input("Please enter your full name: ")

name_without_spaces = name.replace(" ", "")

print(f"Your name in uppercase is {name.upper()}.")

print(f"Your name in lowercase is {name.lower()}.")

print(f"Total number of characters (excluding spaces): {len(name_without_spaces)}.")

print(f"Your name reversed is {name[::-1]}.")

string_manipulation()

Expand full comment