Python Forum

Full Version: Program fishstore()
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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)
print(fs2)
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.
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!