Noob: What is wrong with this code to generate this TypeError?

You are trying to add the tuple month to the string days. Adding a tuple and a string is not allowed.

The line month = "June has ", "July has " sets month to a tuple containing 2 strings.

Thanks for the reply, but I guess i’m not understanding how to get around this.

The way to get around the error depends on what you are intending to do with your code. Based on my guess, it looks like your intention is to call month_days("June has",30) and cause the line "June has 30 days." to be printed.

Currently, when you call month_days("June has",30), the variable month inside the month_days function is set to the value "June has ". Then, in the very next line, you overwrite the month variable with the value ("June has ", "July has "). I don’t think that is your intention. Removing the line month = "June has ", "July has " would get rid of your error.

1 Like

Wow, I was way overthinking it. I thought in order to define Month_days(month, days) that I had to have two separate parameters for this function, one for month, and one for days. I didn’t realize I only needed one parameter for days.

Thank you so much!