December 2017
Beginner
412 pages
10h 8m
English
Imagine you’ve been hired to help write a program to keep track of books in a bookstore. Every record about a book would probably include the title, authors, publisher, price, and ISBN, which stands for International Standard Book Number, a unique identifier for a book.
Read this code and try to guess what it prints:
| | python_book = Book( |
| | 'Practical Programming', |
| | ['Campbell', 'Gries', 'Montojo'], |
| | 'Pragmatic Bookshelf', |
| | '978-1-6805026-8-8', |
| | 25.0) |
| | |
| | survival_book = Book( |
| | "New Programmer's Survival Manual", |
| | ['Carter'], |
| | 'Pragmatic Bookshelf', |
| | '978-1-93435-681-4', |
| | 19.0) |
| | |
| | print('{0} was written by {1} authors and costs ${2}'.format( |
| | python_book.title, python_book.num_authors(), ... |
Read now
Unlock full access