|
1 | | -# Exercise 03_06 - Stats Report |
2 | | -# Given three numbers that represent the number of wins, losses, and draws of a football team, |
3 | | -# write a program that generates a report with the following information: |
4 | | -# 1- The total number of games played. |
5 | | -# 2- The percentage of games won. |
6 | | -# 3- The percentage of games lost. |
7 | | -# 4- The percentage of games drawn. |
8 | | -# The function should return a string with the report. |
9 | | -# For example, given the numbers 3, 2, and 1, the function should return: |
10 | | -# "The team played 6 games. They won 50.0% of the games, lost 33.3% of the games, and drew 16.7% of the games." |
11 | | -# Note: The percentages should be rounded to one decimal place. |
12 | | -# You can assume that the input numbers are > 0. |
| 1 | +# Exercise 03_06 - ISBN Verifier |
| 2 | +# Write a program that checks if a given ISBN number is valid. |
| 3 | +# The ISBN is valid if: |
| 4 | +# - It consists of 10 digits. |
| 5 | +# - The first 9 digits are numbers. |
| 6 | +# - The last digit is a number or an uppercase X. |
| 7 | +# - The ISBN is valid if the sum of the 10 digits multiplied by their position modulo 11 is 0. |
| 8 | +# The program should return True if the ISBN is valid and False otherwise. |
| 9 | +# formula: (d1*1 + d2*2 + d3*3 + d4*4 + d5*5 + d6*6 + d7*7 + d8*8 + d9*9 + d10*10) % 11 == 0 |
13 | 10 |
|
14 | 11 |
|
15 | | -def generate_stats_report(wins, losses, draws): |
16 | | - total_games = None |
17 | | - wins_percentage = None |
18 | | - losses_percentage = None |
19 | | - draws_percentage = None |
| 12 | +def is_valid_isbn(isbn): |
20 | 13 | # Your code should go here. |
21 | 14 |
|
22 | | - return f"The team played {total_games} games. They won {wins_percentage}% of the games, lost {losses_percentage}% of the games, and drew {draws_percentage}% of the games." # noqa |
| 15 | + return ... |
0 commit comments