Comparing Strings using if, else and elif statements

PHOTO EMBED

Fri Sep 23 2022 01:21:27 GMT+0000 (Coordinated Universal Time)

Saved by @L0uJ1rky45M #python

fruit1 = input('Please enter the name of first fruit:\n')
fruit2 = input('Please enter the name of second fruit:\n')

if fruit1 < fruit2:
    print(fruit1 + " comes before " + fruit2 + " in the dictionary.")
elif fruit1 > fruit2:
    print(fruit1 + " comes after " + fruit2 + " in the dictionary.")
else:
    print(fruit1 + " and " + fruit2 + " are same.")
content_copyCOPY

https://www.digitalocean.com/community/tutorials/python-string-comparison