我目前正在EDX中参加初学Python课程,需要有关其所需编码活动的帮助。
计划:
fishstore()
create and test fishstore()
fishstore() takes 2 string arguments: fish & price
fishstore returns a string in sentence form
gather input for fish_entry and price_entry to use in calling fishstore()
print the return value of fishstore()
example of output: Fish Type: Guppy costs $1
答案 0 :(得分:0)
def fishstore():
fish_entry = input("Input fish ")
price_entry = input("Input price ")
return "Fish Type: " +str(fish_entry) + " costs " + str(price_entry)
a = fishstore()
print (a)
这是整个代码......你不明白哪一部分?
答案 1 :(得分:0)
def fishstore(fish,price):
return ("Fish Type: "+ fish.capitalize() + " costs $" + price)
fish_entry=input('Enter fish type: ')
price_entry=input('Enter fish type price: ')
print (fishstore(fish_entry,price_entry))
这个作品。