Python Forum
Program: bookstore() - 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: bookstore() (/thread-25896.html)



Program: bookstore() - muza - Apr-15-2020

## 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!!!!!


RE: Program: bookstore() - ndc85430 - Apr-15-2020

What is the difficulty you're having?


RE: Program: bookstore() - muza - Apr-15-2020

calling previously created function. i am a newbie so it seems hard to me. can you solve it for me?


RE: Program: bookstore() - ndc85430 - Apr-15-2020

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?


RE: Program: bookstore() - muza - Apr-16-2020

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
?