Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
random.shuffle solution in Creative category for I Love Python! by Oleg_Skomorokhov
import random
def subroutine():
l=[]
l.append("I")
l=l+[' love']
s=set(l)
s=s.union(set({' Python'}))
s.update('!')
l=list(s)
return l
def i_love_python():
s=subroutine()
while ''.join(s)!="I love Python!":
random.shuffle(s)
else:
return ''.join(s)
if __name__ == '__main__':
#These "asserts" using only for self-checking and not necessary for auto-testing
assert i_love_python() == "I love Python!"
July 28, 2018