Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #replace even digit with increment 1 & odd with less 1
- # -----------------------------------------------------
- # numbers = [231, 117, 0, 8341, 46709]
- # def check(i):
- # li = list(str(i))
- # toInt = list(map(int, li))
- # for x in toInt:
- # if x % 2 == 0:
- # x += 1
- # elif x % 2 != 0:
- # x -= 1
- # print(x, end='')
- # print('\n')
- # for i in numbers:
- # check(i)
- # reverse word
- # ---------------------------
- words = ['sun rises in the east', 'hello world']
- def check(li):
- x = li.split(' ')
- x.reverse()
- for i in x:
- print(i, end=' ')
- print('\n')
- for i in words:
- check(i)
Advertisement
Add Comment
Please, Sign In to add comment