Python If Number Is Odd
I am learning Python by myself, so I do it myself, think about the problem by myself and then follow the current knowledge style. Maybe not good, not good, but it's the knowledge I am researching more. Hope you missed.
Thread: Enter the number of input. Check if the number is even or odd.
|
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
#!/usr/bin/python
# Check if the number is even or odd
def Checkthenumberodd (number):
number = number % 2
if number == 1:
return "odd number"
elif number == 0:
return "even number"
def main():
number=int(raw_input("Nhap so int: "))
print(Checkthenumberodd(number))
main()
|
Source: https://blebees.com
source https://blebees.com/python-if-number-is-odd/
Nhận xét
Đăng nhận xét