0

How to use regular expressions to evaluate case insensitive word input

I want to make input() parse an any character yes/no so that if the input is 'Yes' or 'yes' or even 'YES' I can write an if statement for it. Using python.

15th Jul 2022, 8:38 AM
ρү૨œdԌ૨ ×
ρү૨œdԌ૨ × - avatar
2 Respuestas
+ 1
if re.findall('(?i)yes', inp): do some stuff
15th Jul 2022, 8:49 AM
Vitaly Sokol
Vitaly Sokol - avatar
+ 1
Thank you Vitaly Sokol . That enabled me to write this: https://code.sololearn.com/cZmcAJtgrqe9/?ref=app
15th Jul 2022, 11:43 AM
ρү૨œdԌ૨ ×
ρү૨œdԌ૨ × - avatar