#๐ Hi, I am a beginner, I am creating a Salary Calculator Project, Why it doesn't print "Hi, Joshua"
13 messages ยท Page 1 of 1 (latest)
@sly garnet
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.
One of print()'s arguments is your input("How many hours...."). It won't get that value until the input() returns a value. So it will run after you enter some hours.
Normally you'd collect the hours the line before the print().
But I also want to say the name of the person while asking how many hours did they work
How do I do that?
like "Hi, Joshua, how many regular hours did you work: "
it's now working, with the help of Gemini XD
So, basically you just have to put f before the input text and add curly braces like {name}
Yeah. That's an "f-string". It's a Python expression which fills in a string like a template. The result is a plain old string, which then gets used by input().
So happy, I finished my first project!
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.