generate functionWed, 08 Feb 2023

When playing "Cities", players take turns calling the names of cities so that the first letter of each new word coincides with the last letter of the previous one. At the same time, it is believed that if the last letter of the previous word is f, then the letter preceding f should be compared with the first letter of the next word. Write a program that reads two lines in a row, and then prints "Good" if the last character of the first line matches the first character of the second (subject to the f rule), and "Bad" otherwise.

def cities (a, b): return a[-1] == b[0] cities('Moscow', 'Piter')

Questions about programming?Chat with your personal AI assistant