0
Below is an example of what I’m trying to do:
lm = input ('Digite uma letra ')
print ('essa é uma letra minúscula? {}' .format(lm.islower()))
I’ve tried to put True = Sim
and False = Não
.
0
Below is an example of what I’m trying to do:
lm = input ('Digite uma letra ')
print ('essa é uma letra minúscula? {}' .format(lm.islower()))
I’ve tried to put True = Sim
and False = Não
.
1
You have to process it conditionally and present what you want. The result of a boolean was not meant to be presented except in very specific circumstances.
lm = input ('Digite uma letra ')
print('essa é uma letra minúscula? {}'.format('Sim' if lm.islower() else 'Não'))
Behold working in the ideone. And in the repl it.. Also put on the Github for future reference.
Can see more about the expression with conditional operator (that some call ternary).
If that’s the condition he gets the first result before the if
, otherwise get the result after the else
, and the result of all that expression is that it will be printed.
You can use f-strings also, just to modernize.
Browser other questions tagged python python-3.x string boolean
You are not signed in. Login or sign up in order to post.