Drop links or images here to add them to the editor.

In a modify task you take code that already works and adapt it so that it does something else.

The editor starts you off with a sub program that says where someone is from, and one call to it:

def my_function(country):
    print("I am from " + country)


my_function("Brazil")

Your task

Adapt the code so that it reports two countries: a fixed one, and one the user chooses.

Do not change the body of the sub program. It is already right, and the sub program’s own print should still be the only one that prints a country line.

The output

Your program prints exactly three lines, in this order:

I am from Sweden
Which country are you from?
I am from Belgium

The first line is always the same, because Sweden is written into the call. The second line is the question, printed exactly as written above. The third line ends with whatever the user typed, so it changes from run to run.

Example

Input:

Belgium

Output:

I am from Sweden
Which country are you from?
I am from Belgium

Input:

New Zealand

Output:

I am from Sweden
Which country are you from?
I am from New Zealand

Input:

Brazil

Output:

I am from Sweden
Which country are you from?
I am from Brazil

The question is part of the output that is checked here, so its spelling, capital letters and punctuation count. Ask it with its own print, exactly Which country are you from?, and read the answer with a bare input() on the next line, rather than passing the question to input(...).

Renaming the sub program is part of the task, but it is not something Dodona can check: the tests compare what your program prints, and the output is the same whatever the sub program is called. Do it anyway. A name that says what the code does is worth more than a name that runs.

Help! My code doesn't work!

Make sure that you check for the following things:

  • The sub program name is spelled identically everywhere it is used, on the def line and at both calls. Capital letters count.
  • There is a colon at the end of the def line.
  • The body of the sub program is indented, and every line of it by the same amount. Never mix tabs and spaces in one file.
  • The calls are not indented inside the sub program.
  • The sub program is defined before it is called.
  • Each call passes exactly one argument, because the def line has exactly one parameter.
  • The country the user types is stored in a variable, and that variable is passed to the sub program without quotation marks around it. Quotation marks would pass the variable’s name instead of its contents.