-
Notifications
You must be signed in to change notification settings - Fork 0
/
task.html
19 lines (19 loc) · 2.19 KB
/
task.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<h2>Print book info</h2>
<html>
<head></head>
<body>
<p>Your task is to write a function <code class="java">print_book_info(title, author=None, year=None)</code> that prints information about a book. Arguments <code class="java">author</code> and <code class="java">year</code> are optional, so be ready that they might equal to <code class="java">None</code>.</p>
<p>You don't have to read the input. The information about a book will be passed to your function, and it should output it in the right format.</p>
<p>See the samples below to understand the output format.</p>
<p></p>
<div class="alert alert-warning">
The knowledge of
<strong>if-elif-else</strong> statements is expected in this task. If it's not the case, please proceed to the next challenge.
</div>
<p></p>
</body>
</html><br><b>Sample Input:</b><br><pre><code class="language-no-highlight">title: War and Peace<br>author: Leo Tolstoy<br>year: 1869</code></pre><br><b>Sample Output:</b><br><pre><code class="language-no-highlight">"War and Peace" was written by Leo Tolstoy in 1869</code></pre><br><br><b>Sample Input:</b><br><pre><code class="language-no-highlight">title: Crime and Punishment<br>author: None<br>year: 1866</code></pre><br><b>Sample Output:</b><br><pre><code class="language-no-highlight">"Crime and Punishment" was written in 1866</code></pre><br><br><b>Sample Input:</b><br><pre><code class="language-no-highlight">title: The Chronicles of Narnia<br>author: C. S. Lewis<br>year: None</code></pre><br><b>Sample Output:</b><br><pre><code class="language-no-highlight">"The Chronicles of Narnia" was written by C. S. Lewis</code></pre><br><br><b>Sample Input:</b><br><pre><code class="language-no-highlight">title: Harry Potter<br>author: None<br>year: None</code></pre><br><b>Sample Output:</b><br><pre><code class="language-no-highlight">"Harry Potter"</code></pre><br><br><br><font color="gray">Memory limit: 256 MB</font><br><font color="gray">Time limit: 15 seconds</font><br><br>
<b>Caution</b><br><br>
You may see errors in your code or execution results due to missing context. Don’t worry about it, just write the solution and press Check.
<br><br>
<a href="https://hyperskill.org/learn/step/8077">Show topic summary</a>