ValueError: Unknown format code 'f' for object of type 'str'

hi i would like a little help to fix this error which prevents me from finishing my project

@HabrahamGobey

Hey, Maybe the type of your hour and avg variable is a string that’s why you are getting error.

Try doing this,

h=int(hour)
a=float(avg)

Hope this helps!!

Hello @HabrahamGobey,

When asking a question, make sure to follow the Technical Question Guidelines . When you ask the question properly you have more chances to receive a fast, accurate answer.

It is important to post a piece of well-formatted code instead of an image. Notice that it is not even possible to see the entire code in the image you posted. Also, make sure to post in our Q&A section , to where I am moving this topic now.

1 Like

hello @otavios.s
Received thank you

1 Like

hi @jenil2452000
I tried but the problem is still not resolved

@HabrahamGobey, as I said, when you ask the question properly you have more chances to receive a fast, accurate answer. People cannot even see the entire line of code that is raising the error. Therefore, you cannot expect to have your question correctly answered. Please fix it.

@HabrahamGobey

Hey, if you got this kind of error by implementing my suggestion

ValueError: invalid literal for int() with base 10: '15:00'

then just don’t do this h=int(hour)

only keep this one a=float(avg)

Otherwise please give more info so somebody can help you!!