#๐ Confused Math
38 messages ยท Page 1 of 1 (latest)
@vivid iron
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.
what inputs did you use when your program returned 15?
or which 15 are you talking about? line 26?
no it cant be line 26 because the only way the "15" on output changes is when i change the line 10 number from 4
i changed the number 4 to 5 and the output turned to 10. xD
im beyond lost right now haha
be careful setting your charge to 0
right now it reads if your sign is oak, but not gold, then your sign is free
you don't need an else in both those situations
if the sign is not oak or the sign is not gold, the price does not adjust at all
you are printing total_charge not charge, 35 - 20
i thought with how i did it the "total_charge" would be the "price and "additional_character_charge" which would add up the "base_price(35) with the "charge" of oak and(or) gold. ๐คฃ
doesnt setting it to 0 initialize it though?
It'll reset a variable to 0, which doesn't seem to be what you want to do.
Instead, add the values to the total charge if the conditions are met
Okay, so if i change the print to print the "price" it sends the "base_price". if i change it to "charge" it sends it with the oak and gold charge. Why would it not add up with what i have written on line 11?
I fixed this issue thank you
yes, but you're using the same variable for wood_type and color
The lines are evaluated at the time they are reached.
if a = 2 and b = 3 and you encounter a line that says c = a + b c gets set to 5
If later on a or b changes it doesn't get recalculated.
!e
a = 5
b = 7
c = a + b
print(c)
a = 100
print(c)
:white_check_mark: Your 3.12 eval job has completed with return code 0.
001 | 12
002 | 12
an example of what Grote is saying
variables are not dynamic this way. Just because a changed doesn't mean c updates
We're not storing that formula in the variable. We're simply evaluating it
okay that makes sense thank you guys. ill try to fix this stuff and come back if i get lost lol.
okay so i fixed all the other issues. ive been experimenting with this. I understand you cant use length on integers, but what other way can i represent this?
Instead of num characters, why not ask them to input their sign message
then you can use len on that string
I think you've also overcomplicated your if statements to check for gold and oak
if wood_type == 'oak':
charge += 20
if color == 'gold':
charge += 15
this is all it needs to be
because the assignment requirements ask for number of characters, otherwise thats what i would of went with. and oh wow yeah i defintely did overcomplicate it then LMAO.
well then you don't need len at all, just use the value as is
if it's 15 characters, then isn't that the value that you want?
if you were able to get the len of this, it would be 2 digits. Is that useful information?
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.