#๐ My reply wont reply after i say what i need to
104 messages ยท Page 1 of 1 (latest)
@median lark
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.
remove parentheses around glock
im new
can u send the symbol
so i know what it is
cuz im kinda confused
is it ()?
u see the ( and ) around "Glock"? delete them
offfff
ohhhhhh
i see
im stupid
thank you
im gonna post some more problems here prob
do u mind if i ping u when i do?
no ping, just post
kk
the () shouldn't affect it
are you typing glock or Glock for the input?
Strings are case sensitive
glock and Glock will not be equal
how are you running this? Can you show us a screenshot of your test?
I haven't used it, but it looks like you might be typing a space before you type Glock?
what do u use
I use sublime or pycharm, but it shouldn't matter for this
are you typing a space before you type Glock?
IT WORKS
THANK YOU SO MUCH
i was in lesson tryna do it for 1h
my friend was confused
thx bro
np!
do u mind if i ping u if i have more problems??
or do i just need to post
yo how i fix this cuz i tried some things i search up online but still nothing
you're not using input for the second question
Try inputting "installments" when running the program, and you'll see what they mean.
you use input(...) (like in your first line), whenever you want to have the user type something
and store it in a variable
After the first if statement, ask for another input.
buy_gun = False
i = input("What gun do you want to buy today?")
if i == "Glock":
print("That will be ยฃ50.")
buy_gun = True
else:
print("I'm sorry. We don't have that gun here.")
if buy_gun:
i = input("Do you want to do installments or pay it all at once?")
Here's one way to go about doing something similar.
First, we create a variable called buy_gun.
This will tell the program whether the user wants to buy a gun.
Then, the program will ask the user to input what gun they want to buy.
If they input "Glock," they will get told the price, and buy_gun will be set to true.
kk
Then, when buy_gun is true, it will ask if they want to do installments or not.
kk
i understand
can u like explain how u did it tho
i see the code
but i dont understand what u did
Sure.
kk thank you
The first line declares a boolean variable.
It's a variable that's either true or false.
We're going to use it to see if the user is buying a valid gun.
Next, we ask for the input and save it to i.
kk
After that, we enter into an if-else statement.
Do you understand how those work? I see you know what an if statement is, but I want to make sure since you seem like a beginner.
i do
my friend told me what if statements are
im guessing if-else is like a if this is true this happens if this is false this happens
That's right!
yippiee!!
Basically, the if-else statement will first check if the input is "Glock." If it's indeed "Glock," it will print a message and set buy_gun to True.
But if it's not that, it'll give a different response, and buy_gun remains false.
i see
Finally, we enter one last if statement.
If buy_gun is true, it'll ask for the user's input again.
@median lark, would you like to see something a bit more advanced? It would be a pretty good alternative if you plan on having multiple types of guns.
i think i might try it by myself
but if i need help i will dm u
but thanks for the offer
i learned alot
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.