Skip to content

Instantly share code, notes, and snippets.

@a-eid a-eid/task.py
Last active Nov 19, 2017

Embed
What would you like to do?
import numbers
def numOrString(list):
cache = []
strings = []
nums = []
for n in list:
if(isinstance(n, numbers.Number)):
pass
cache.append(1)
nums.append(n)
else:
pass
cache.append(0)
strings.append(n)
return (cache , strings , nums,)
def main((cache , strings , nums)):
strings.sort()
strings.reverse()
nums.sort()
nums.reverse()
for i , c in enumerate(cache):
if c == 0:
cache[i] = strings.pop()
if c == 1:
cache[i] = nums.pop()
return cache
# how to call it
# main(numOrString( ["str" , 1 ,2,3 "asdf", ...] ))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.