0
How to make answer upper and lowercase on python
If asking a question in python, for example, user_question = input(“What data type is True?”) print(user_question) if user_question == “Boolean” print(“Correct”) How would I make it so even if user puts lowercase it would still be right. Would I use .lower() for the print statement?
2 Respostas
+ 7
.lower() makes all letters lower case
.upper() makes all letters upper case
.title() makes the first letter upper case & the rest lower case
This link is handy to show string methods
https://www.w3schools.com/JUMP_LINK__&&__python__&&__JUMP_LINK/python_ref_string.asp
+ 6
Not for the print statement but for the if condition:
if user_question.lower() == "boolean":