#๐Ÿ”’ Please help.

29 messages ยท Page 1 of 1 (latest)

late quiver
#

Why am I getting this error message

sharp berryBOT
#

@late quiver

Python help channel opened

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.

late quiver
#

I genuinely dont know whats wrong and need help like really urgently.

coral elm
#

I wouldn't be defining constants inside a function

late quiver
#

What does that mean

#

This is like my 2nd project Im new to python entirely

coral elm
sterile glen
#

the variable only exists inside the function

coral elm
#

you're creating variables that only exist inside the calculate_bill function

late quiver
#

So how do I fix that

sterile glen
#

you can define it outside the function

#
x = "hello world"
def func(y):
  print(y)
func(x)```
you can pass variables to functions this way
late quiver
#

So just put the def calculate_bill after the constant definitions

coral elm
#

I don't actually know what you're trying to do

#

so it's difficult to tell you the best option

late quiver
#

Just make a calculator for a project

#

And for some reason its telling me one of the variables is undefined

coral elm
#

ok, so one option is to simply indent everything under that function

late quiver
#

Well now its just coming out blank

coral elm
#

now you need to call the function

#

add calculate_bill() at the very bottom (not indented)

late quiver
#

Thank you so much Fashoomp. I owe you the world.

sharp berryBOT
#
Python help channel closed

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.