Error in code: Str instead of int
This file cannot be displayed: https://storage.googleapis.com/replit/images/1556741279997_7e49c131f709d5cb362e70f19917ea74.pn
I tried to execute this code, and I got an error for line 6, str instead of int. I don't know where to make the correction.
You can use the int function (actually a class) to change the type. The input returns a string, not integer. Therefore, you must change the string to an integer. For example:
int(boundLow) For more information on the difference between strings and integers, look at Stack Overflow
Please mark this as the correct answer if this was helpful thanks! Or if you cant please upvote
When you take an input, it returns a string. When you add two strings together, they join so if
boundUp was 5 then
boundUp + 1 is
range() function only takes a number, so it doesn't know what to do with a string like that. To fix this you could change this
boundLow = input('blah blah blah')
boundLow = (input('blah blah blah'))
Note: This only works on whole numbers, not decimals. If you want to take a decimal input use
float instead of
int but this will not work with
I am a repl.it helper. Please mark my comment as the answer and/or upvote if it helped you.