Posts: 455
Threads: 16
Joined: Jun 2022
Aug-31-2022, 02:42 PM
(This post was last modified: Aug-31-2022, 02:42 PM by rob101.)
Keep in mind that if you do use
.title()
, then
"Paris"
in not the same as
"PARIS"
or
"paris"
, which is why I prefer to store data in one format or another (usually lowercase) and then case change any user input:
user_input = input("Enter your text: ").lower()
so that it's easy to make any comparison to the stored data:
if user_input == data:
Any output can be formatted correctly, as in, for example:
print(f"{city}".title())
where
city
could be
"PARIS"
or
"paris"
, or whatever.
Sig:
>>> import this
The UNIX philosophy: "Do one thing, and do it well."
"The danger of computers becoming like humans is not as great as the danger of humans becoming like computers." :~ Konrad Zuse
"Everything should be made as simple as possible, but not simpler." :~ Albert Einstein