()
| 4 | |
| 5 | |
| 6 | def get_integer(): |
| 7 | for i in range( |
| 8 | 3, 0, -1 |
| 9 | ): # executes the loop 3 times. Giving 3 chances to the user. |
| 10 | num = input("enter a number:") |
| 11 | if num.isnumeric(): # checks if entered input is an integer string or not. |
| 12 | num = int( |
| 13 | num |
| 14 | ) # converting integer string to integer. And returns it to where function is called. |
| 15 | return num |
| 16 | else: |
| 17 | print("enter integer only") |
| 18 | print( |
| 19 | f"{i - 1} chances are left" |
| 20 | if (i - 1) > 1 |
| 21 | else f"{i - 1} chance is left" |
| 22 | ) # prints if user entered wrong input and chances left. |
| 23 | continue |
| 24 | |
| 25 | |
| 26 | def addition(num): |
no outgoing calls
no test coverage detected