#๐ Help me guys
96 messages ยท Page 1 of 1 (latest)
@gilded heart
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.
welp this is hard
I've written nothing so far
oh wait
You've asked a lot of similar questions to this before. There will be a lot of the same code as the others
So i should open a variable first?
What do you think the order should be?
and I'm not really sure what you mean by this
Look at your previous code examples. How did you get the user to type something in?
input
Yes exactly
So make sure you use that here as well
Use input to ask the user if they are a member
Use input to ask the user to input the product price.
Calculate the total based on whether or not they are a member
Display the price
These are your steps
Start by trying to write the code for each of those steps
show your code
moving on what do I do?
a_member = input("Are you a member: ")
product_price = int(input("what is your product price? "))
Are you sure you should be using int here?
Yes exactly ๐
Do you know how you calculate a percentage of another number?
Not necessarily in python
but if you had a calculator?
I do
Ok, so what are you unsure of?
divide by 10 if I am not mistaken
lets say my product is 65 dollars
then we divide it by 10%
65 divide by 10%
And then 
||He could subtract by the 65/10, it's static||
You should use multiplication here
It just so happens to work with this, but it's not really best practice
There's two ways to think of this
Yes, well
if the cost is 65
we could multiply it by 0.9
that's 90% of the original value
which is the same as 10% off
okay
(1-0.1)
or, we can multiply by 0.1, and then subtract that from the original value
I'll take this
product_price - (product_price * 0.1)
your condition isn't related to the price. It's related to whether or not they're a member
If they're a member, give them a discount. Otherwise, they pay full price
can you type it in code?
What do you think you need to be checking for?
This is the important part
If they say yes, give discount
I've given you the idea, not the literal code
How do you compare if two things are equal in python?
We haven't learned that yet
Yes you have. I linked a thread with your own code where you use a comparison
The if after the else is not necessary
I can use elif?
We can just assume if they don't say "yes", then they aren't a member
We don't need to check specifically for "no"
Oh okay
Otherwise you end up with 3 situations
"yes"
"no"
other
there's really no difference between "no" and other so we can just lump them together
This help channel has been closed. 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.