How to ignore case when comparing strings in Python

1 Answer

0 votes
first_string = "Python programming language"
second_string = "PYTHON PROGRAMMING LANGUAGE"

if first_string.casefold() == second_string.casefold():
    print("The strings are equal")
else:
    print("The strings are not equal")

 
 
 
'''
run:
 
The strings are equal

'''

 



answered Aug 9, 2022 by avibootz

Related questions

1 answer 261 views
2 answers 192 views
1 answer 159 views
2 answers 196 views
2 answers 320 views
...