C1M1_Assignment - Final Question

Hi Team,

I’m stuck on the final assignment question for week 1.

The Aim: * The printed message should be in the format using multi-line f-string as, <Requested Book> is currently unavailable. You can request it from the library.

My code or answer is:


### START CODE HERE ###

    # mentor edit: code removed

### END CODE HERE ###

Problem: My code does not seem to work but I can’t figure out why.
Anyone have any tips?

Thank you in advance :slight_smile:

1 Like

Please do not share your code on the forum. That is not allowed by the Code of Conduct.

I will edit your message to remove your code.

Hopefully a mentor for this course will stop by to assist you.

1 Like

Hi @Milo2,

Your two sentences need to be on the same line, same spacing and using periods (.) as the expected output.

Make this change and let me know how it goes.

Best,
Mubsi

1 Like

Hi @Mubsi,

Thanks so much for replying. I have made the suggested edits but same issue.
I have decided to use a clean notebook as I think it could be the missing run button.

In the new notebook - I now get the following error message for each question from Exercise 1B onwards:

“Failed test case: There was no output for exercise 1b cell, check that you run it.
Grader expected: An output generated from print statements
You got: None”

I had passed Exercise 1B and Exercise 2 previously and used the same code.
Any tips?
Thanks in advance.

hi @Milo2 , the error say that is not getting any output, remember to run each cell from top to bottom if anything is stoping it from working, like a missed libraries, a missing definition… also the error say that expect the answer/output on a print statement, so make sure you are correctly passing the output to a print(), f-strings, are string that can have variables inside as the next example that would print the current date with a text string, in this case the variable is a function but can just be another string or number… date = 31/5/2025 (this is not dynamic)

def get_current_date_string():
    """
    Returns the current date formatted as 'YYYY-MM-DD'.
    """
    now = datetime.datetime.now()
    return now.strftime("%Y-%m-%d")

# Get the current date using our function
current_date = get_current_date_string()

# Create the f-string with the embedded date
message = f"Hello world {current_date}!!!"
1 Like

Many thanks Deminiko.
Assignment done and graded :slight_smile:

1 Like