Python Forum

Full Version: Program: bookstore()
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
## 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!!!!!
What is the difficulty you're having?
calling previously created function. i am a newbie so it seems hard to me. can you solve it for me?
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?
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
?