Import question

city.py

def city_country(city, country):
    print(f"{city.title()}, {country.title()}")
from city import city_country
print(city_country('santiago', 'chile'))

I am learning import and a strange thing keeps happening. When execute the second block code, the product is

Santiago Chile
Santiago Chile
None

when the first block of code produces

Santiago Chile

Why is there a None at the end?

You must select a tag to post in this category. Please find the tag relating to the section of the course you are on E.g. loops, learn-compatibility

When you ask a question, don’t forget to include a link to the exercise or project you’re dealing with!

If you want to have the best chances of getting a useful answer quickly, make sure you follow our guidelines about how to ask a good question. That way you’ll be helping everyone – helping people to answer your question and helping others who are stuck to find the question and answer! :slight_smile:

your city_country question doesn’t return anything, yet when you call the function, you print the returned result. Given there isn’t anything returned, you see None (the absence of a return value)