Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Python Principles Question?

Can anyone solve this? I'm utterly stuck.

Write a function named make_day_string that takes an integer named day and returns the string "it is day X of the month" where X is the value of the day parameter.

For example, calling make_day_string(3) should return "it is day 3 of the month".

Remember that to concatenate a string with an integer, you must cast the integer to a string.

Note that the function should return a value. It should not print anything.

Attachment image

3 Answers

  • 2 months ago

    Hi, babaloooooo.

    If I give you the answer to this question, maybe you could have a go at the next one yourself? Again, if you get stuck, *post* *your* *code* so we can see that you're trying to figure these out for yourself.

    I've included a line of code which is there to test the function and see if it works as it's supposed to. You don't need to include the print statement in your answer, just the function.

    def make_day_string(day):

        return "it is day "+str(day)+" of the month"

    print (make_day_string(3))

  • 2 months ago

    Ive tried multiple times to solve it. How would this question be from a bot? what? lol. Im just looking for an answer and ull get your vote or whatever.

  • BigE
    Lv 7
    2 months ago

    You need to split the task.  This is more of how to write a function.

    First, create a python function.  There are probably a billion examples.

    Then figure out how to pass and return values, then figure out what you want to return.

    And of course add error checking.

Still have questions? Get your answers by asking now.