I’m trying to convert a string to an integer using the int() function in Python, but I’m getting:
ValueError: invalid literal for int() with base 10: '3.5'
Here’s my code:
When I run this code, I get the above error. I’m not sure what’s causing this error or how to fix it. Can someone help me understand what’s going on here and how I can resolve this issue?
Also, can someone explain what the
base parameter in the
int() function does and how it might be related to this error? Thank you for any help you can provide!