How to capitalize string without using a function in Python?

How can I capitalize a user’s input (string) without using functions such as: title, capitalize and etc.?
For example

enter a book title: tHe LoRd oF thE RiNgs: subtititle
and let the exit be: The lord of the rings: “subtitle”

Dear @david_xp,
Use a for loop, traverse the whole string and use ASCII value to change ‘a’ to ‘A’.


thanks, and how can I do it when the user enters “:” in the output that text comes out in quotes?
input: The lord of the rings: the return of the king
out: The Lord of the Rings: “The Return of the King”

Implement the logic on alphabets only, use following condition:

    if (char>='A' and char<='Z') or (char>='a' and char<='z'):
1 Like