Program fishstore() - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Homework (https://python-forum.io/forum-9.html) +--- Thread: Program fishstore() (/thread-7467.html) |
Program fishstore() - Truman - Jan-11-2018 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. RE: Program fishstore() - wavic - Jan-11-2018 Remove the parameters from the function definition since you do not use them. Call the function without parameters. RE: Program fishstore() - Truman - Jan-12-2018 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! |