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 Answers
+ 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