Problem 11. Odd Number Lab: Conditional Statements and Loops
Take as an input an odd number and print the absolute value of it. If the number is even, print "Please write an odd number." and continue reading numbers.
Input
You will receive even integers until you receive an odd number.
Output
Print "Please write an odd number." if the received number is even. If the number is odd – "The number is: {number}".
Constraints
- You will receive maximum 10 numbers
- The numbers will be in the interval [-1000…1000]
-
Examples
Input
Output
Input
Output
2
4
5
Please write an odd number.
Please write an odd number.
The number is: 5
-7
The number is: 7
-
num = int(input()) while -1000 <= num <= 1000: if num % 2 == 0: print("Please write an odd number." ) else: print(f"The number is: {abs(num)}") num = int(input())
- КРАЕН РЕЗЕЛТАТ 0/100 ЯВНО ГРЕШКАТА Е МНОГО ГЛУПАВА НО НЕ Я ВИЖДАМ
МНОГО ВИ БЛАГОДАРЯ !!!