Python Functions: Using Built-in Functions and Creating Functions - Screen 5/8

When we have converted the day and year to string in the body when do we add “” to it in the argument and not add the same to month??

Hello @mursuljamil

Your question is kinda confusing, can you try to rephrase and be clear on what you’re trying to ask, if possible?

initially, parameters day and year are strings in this form, ‘15’ and ‘2006’, so we must convert them to int like int(‘5’) or int(‘2006’) then they become integer numbers. You need not to do any thing on month parameter because we want it to remain a string like "July’.

Sorry there is typo error… convert the second ‘when’ in the sentence to ‘why’ and you’ll understand it hopefully : )

But day and year have not been converted to integer in the solution…

I have corrected my mistake of concatenating str and int

Or, sorry, I am concatenating str with int, it can’t. Maybe, your question in the part of adding “” needs to be checked or rephrased , if I am not mistaken

You have added quotation marks for month in the argument, because the month argument is supposed to be a string. And in the body of the function, we are concatenating strings, and it makes sense to add quotation marks for the month in the argument. I hope I answered your question.

Alright, it makes sense to add quotation marks to the month in the argument, but why do we add quotation marks to day and month in the body of the function and not in the argument area?

Alright, now I understood your first question.

Firstly, we aren’t adding quotation marks to day and month in the body of the function. Those quotation marks are for spaces. Take those quotation marks out in the function, the function would still work fine. But, the output wouldn’t have spaces. The output would be like:

July152006

And in the argument, we aren’t adding any quotation marks to the day and month, because we are changing (casting) the type of data in the function itself i.e. we are converting the day and month as string in the function itself. I hope, it’s clear now. Feel free to ask, if you have any more questions.

1 Like

Thanks @vishallbabu5 for sensing out and interpreting what the question is looking for. In addition @mursuljamil, the two addition signs on both sides of the spacing quotes are not for transferring quotation marks to month and day, but for concatenation or joining arguments together. Thank you