Python Forum
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Program fishstore()
#1
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.
Reply
#2
Remove the parameters from the function definition since you do not use them. Call the function without parameters.
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#3
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!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  fishstore question for edx geryhnd001 1 1,861 Mar-23-2020, 08:38 AM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020