This code allows a user to enter the names of two countries, compares the names and prints out a message
Ask user to input two countries
country1 = input(‘Please input the first country: ‘) country2 = input(‘Please input the second country: ‘)
Compare the two countries
if country1 == country2: print(‘The two countries are the same!’) # print out a message if they are the same elif country1 != country2: print(‘The two countries are different.’) # print out a different message if they are different if len(country1) > len(country2): print(country1 + ‘ has more letters than ‘ + country2 + ‘.’) # print out another message if the length of country1 is greater than country2 else: print(country2 + ‘ has more letters than ‘ + country1 + ‘.’) # print out another message if the length of country2 is greater than country1
Loading...