Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Program: bookstore()
#1
## Program: create new function bookstore()
create and test function bookstore()
- **bookstore() takes 2 string arguments: book & price**
- **bookstore returns a string in sentence form**
- **bookstore() should call title_it_rtn() #it is a function previously defined# ** with book parameter
- **gather input for book_entry and price_entry to use in calling bookstore()**
- **print the return value of bookstore()**
>example of output: **Title: The Adventures Of Sherlock Holmes, costs $12.99**
^^
^
^previous code:
def title_it_rtn(c):
    return (c).title()
_input= input()
title_it_rtn(_input)
print(title_it_rtn(_input))
i cant code it. help!!!!!
Reply
#2
What is the difficulty you're having?
Reply
#3
calling previously created function. i am a newbie so it seems hard to me. can you solve it for me?
Reply
#4
We aren't going to do the work for you. Calling a function is pretty trivial and you're already doing it in that code. What have you tried and why do you think it isn't working?
Reply
#5
def bookstore(book, price):
    book=title_it_rtn(book_entry)
    return 'Title: ' + book + ' costs $' + price

book_entry = input("enter book name: ")
price_entry = input("price: ")
info=bookstore(book_entry, price_entry)

bookstore(book_entry, price_entry)
is this perfectly ok?
i have one more question. when i create a function with return value, it outputs with single quotes example:
Output:
'my output'
. why this happens. can i remove this so it looks like
Output:
my output
?
Reply


Forum Jump:

User Panel Messages

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