Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1. Determining even numbers
- Functions : Determine if the number entered is an even number
- > f.name = Even Number
- > Make a return type with and without a type, with two functions
- > 0 is 0 output
- [Example Output Result]
- Enter number : 20
- func 1 : Even # return type
- func 2 : Even # without return
- '''
- # return type
- def EvenNumber(a) :
- a = int(input('Enter number : '))
- if a != 0 and a % 2 == 0 :
- result = print('Even')
- if a == 0 :
- result = print('0')
- return result
- result = print('func 1 : {}'.format(EvenNumber(result)))
- # without return
- def EvenNumber(a) :
- a = int(input('Enter number : '))
- if a != 0 and a % 2 == 0 :
- print('Even')
- elif a == 0 :
- print('0')
- return
- EvenNumber(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement