#๐ Bugs/general confusion
29 messages ยท Page 1 of 1 (latest)
@blissful hatch
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
Problem with if statement within if statement as well as the len(varriable) won't count a int in the string if its single digit
show us your code
input always returns a string, so if weeks == 1 will never be true
you need to convert it into an int using int
weeks = int(input("How many weeks did you work?"))
gotcha thats super helpful
what about the line 50
and the single digit number
is because I also need to change the numbers into an int?
well, what does it mean to take the len of a number
is it the number of digits
it gives u an int value based on how many strings there are in the varriable yeah
well items I think like strings bool and int
if you want to get the number of digits in a number, the simplest way is to convert it to a str and take its len
!e
x = 538
print("number of digits is:", len(str(x)))
:white_check_mark: Your 3.12 eval job has completed with return code 0.
number of digits is: 3
I want the amount of int that were inputed. so if I inputed 10, 5, 60, 4 it should show up as 4 I thought but instead it is showing up as 2
you're confusing your variables...
total_hours = input("What was the total number of hours worked in one week?")
total hours is each individual input, not the list of all inputs
oh biscuits
if you inputed total hours as 12 though and did the len command it would show up as 1 yes?
len on what
I think im understanding. So my numbers are they going into the variables as int rather than strings hence why the len command is counting them
I don't think that's quite the problem...
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.