Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- # find ASCII value
- # ---------------------------
- # number to char: char(var)
- # char to no: ord(var)
- # x = 'CAT'
- # toList = [i for i in x]
- # result = 0
- # for i in toList:
- # result+=ord(i)
- # print(result)
- # find it is square root or not
- #---------------------------------
- y = [4, 10, 64, 99, 25]
- for i in y:
- # find the square root value & convert into string
- rootVal = str(math.sqrt(i))
- #convert into list
- rootvalToList = rootVal.split('.')
- #convert the str list into int list
- rootvalListToInt = list(map(int, rootvalToList))
- # check the 2nd index is 0 or not
- if rootvalListToInt[1] == 0:
- print('yes')
- else:
- print('no')
Advertisement
Add Comment
Please, Sign In to add comment