compare string python
text1 = 'apple' text2 = 'apple' text1 == text2 #RETURNS true
comparison python
number_of_seats = 30 numbre_of_guests = 25 if numbre_of_guests <= number_of_seats: print("it's ok") else: print("it's not ok")
Source: openclassrooms.com
string comparison in python
# Comparison is done through "lexicographic" order of letters # Change the variable 'word' then run and see the results # Remember a capital letter comes before a simple letter word = 'banana' if word == 'banana': print('All right, bananas.') if word < 'banana': print('Your word', word, 'comes before banana') elif word > 'banana': print('Your word', word, 'comes after banana') else: print('All right, bananas.')
Source: www.py4e.com
in comparison in python
'GE' in VINIX >>> False 'GOOGL' in VINIX >>> True
Source: classroom.udacity.com