# -*- coding: utf-8 -*- """ Spyder Editor This is a temporary script file. """ fsdfsdfsdfsdf import random recipient = [] sender = [] santas= [] totalSantas=int(input("How many santas???")) for i in range(totalSantas): santas.append(input("What is your name good sir?")) for i in range(totalSantas): sender.append(i) recipient.append(i) #random.shuffle(sender) #print(sender) n=0 #for t in range(5): for i in range(totalSantas): print("before shuffling, sender[%d] is %s and recipient[%d] is %s " % (n,santas[i],n,santas[recipient[n]])) while sender[n] !=recipient[random.randint(0,totalSantas-1)]: random.shuffle(recipient) n+=1 for k in range(totalSantas): print("%s is the Santa for %s " % (santas[sender[k]] , santas[recipient[k]] )) print("*"*30)
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question