Return the mid-number(whole) of two integers a and b >>> get_avg(10, 15) 12 >>> get_avg(20, 300) 160 >>> get_avg("abcd", 300) Traceback (most recent call last): ... TypeError: can only concatenate str (not "int") to str >>> get_avg(10.5,50.25) 30
(number_1: int, number_2: int)
| 56 | |
| 57 | |
| 58 | def get_avg(number_1: int, number_2: int) -> int: |
| 59 | """ |
| 60 | Return the mid-number(whole) of two integers a and b |
| 61 | |
| 62 | >>> get_avg(10, 15) |
| 63 | 12 |
| 64 | |
| 65 | >>> get_avg(20, 300) |
| 66 | 160 |
| 67 | |
| 68 | >>> get_avg("abcd", 300) |
| 69 | Traceback (most recent call last): |
| 70 | ... |
| 71 | TypeError: can only concatenate str (not "int") to str |
| 72 | |
| 73 | >>> get_avg(10.5,50.25) |
| 74 | 30 |
| 75 | """ |
| 76 | return int((number_1 + number_2) / 2) |
| 77 | |
| 78 | |
| 79 | def guess_the_number(lower: int, higher: int, to_guess: int) -> None: |