Hello guest, if you read this it means you are not registered. Click here to register in a few simple steps, you will enjoy all features of our Forum.
Bottom Page

Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Program fishstore()
my assignment is:
create and test fishstore()
fishstore returns a string in sentence form
gather input to fish_entry and price_entry to use in calling fishstore()
print the return value of fishstore()

my code:
def fishstore(fish, price):
    fish_entry = input()
    price_entry = input()
    sentence = fish_entry + "costs" + price_entry + "dollars."
    return sentence
fs2 = fishstore(fish_entry, price_entry)
I did something very wrong since I don't even get an option to add type of fish and price. Help is appreciated.
Remove the parameters from the function definition since you do not use them. Call the function without parameters.
Truman likes this post
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
Now I'm receiving error:
NameError Traceback (most recent call last)
<ipython-input-1-be504d5f6ef8> in <module>()
4 sentence = fish_entry + "costs" + price_entry + "dollars."
5 return sentence
----> 6 fs2 = fishstore(fish_entry, price_entry)
7 print(fs2)

NameError: name 'fish_entry' is not defined

edit: I removed parametres from from calling function and now it works just fine!

Top Page

Forum Jump:

Users browsing this thread: 1 Guest(s)