python function Exercise 2

City: Write a function named city_country (), which takes the name of the city and belongs

country. This function should return a format string like this below:

------------------------------
"Santiago, Chile"

------------------------------

 

 

def city_country(city_name,country_name):
    city_country_name = city_name+'  '+country_name
    return city_country_name

i=0
while i<3:
    ci_name = input("Please enter the city name: ")
    co_name = input("Please enter the country name: ")
    ci_co_name = city_country(ci_name,co_name)
    print(ci_co_name.title())
    i+=1
    while i==3:
        chioce = input("You have entered it three times. Would you like to try to enter new three times(y or n)? ")
        if chioce == "y":
            i=0
        else:
            print("Welcome to play next time! Bye!")
            break

 

Guess you like

Origin www.cnblogs.com/show530/p/12433323.html