#🔒 (Deutsch) im a beginner
14 messages · Page 1 of 1 (latest)
@undone pagoda
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.
!rule english
(Machine translation: Is that right, so I somehow diffened the ticket correctly?
If anyone has questions, ask me, I have a little more content, I'm an absolute noob.)
4. Use English to the best of your ability. Be polite if someone speaks English imperfectly.
This isn't correct Python code. Can you copy/paste it as text please, not a screenshot?
An if statement is an imperative, not an expression. So there should be no Ticket = before the if...elif....
It looks like you're offering distinct ticket prices for each film, and each client age (children, normal, senior).
It would normally look a bit like:
if Film.lower() == "kunfupanda":
if age < 14:
ticket = 6
elif age >= 60:
ticket = 8
else:
ticket = 10
elif Film.lower() == "starwars":
... and so on ...
Normal numbers in Python do not have units, so you can't say that the ticket prices are un Euros directly. You just need to know. Sometimes you might note this in the variable name, eg using ticket_euros=8 instead of ticket=8. This is purely a note for the reader - it has no ready effect.
There are some third party libraries around for dealing with "numbers with units", such a units of measurement or currencies. I would not worry about them at this point.
@undone pagoda
Machine translation:
Eine if-Anweisung ist ein Imperativ, kein Ausdruck. Es sollte also kein Ticket geben = vor dem if...elif....
Es sieht so aus, als ob Sie für jeden Film und jedes Kundenalter (Kinder, normale, Senioren) unterschiedliche Ticketpreise anbieten.
Es würde normalerweise ein bisschen so aussehen:
Wenn Film.lower() == "kunfupanda":
Wenn Alter < 14:
Ticket = 6
Elif Alter >= 60:
Ticket = 8
Sonst:
Fahrkarte = 10
Elif Film.lower() == "Starwars":
... Und so weiter ...
Normale Zahlen in Python haben keine Einheiten, so dass Sie nicht direkt sagen können, dass die Ticketpreise in Euro sind. Du musst es nur wissen. Manchmal können Sie dies im Variablennamen bemerken, z.B. mit ticket_euros=8 anstelle von ticket=8. Dies ist rein eine Notiz für den Leser - es hat keine fertige Wirkung.
Es gibt einige Bibliotheken von Drittanbietern, die sich mit "Zahlen mit Einheiten" befassen, wie z. B. Maßeinheiten oder Währungen. Ich würde mir zu diesem Zeitpunkt keine Sorgen um sie machen.
that is quite irrelevant and totally off topic
Don't hijack other people's help threads to make introductions. Go to any of the 3 offtopic channels (they start with "ot", e.g. #ot0-lord-invers-spirit-animal)
if you want help you can either start your own help thread or you can ask in #python-discussion
for off topic stuff see the channel mentioned above
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.