Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def getSpecial(num,index):
- while index >0:
- index-=1
- num//=2
- return num
- def printFacts(name,symbol,atomicNum, period, group,bypass=dict()):
- factTuple= (name, symbol, str(atomicNum), "Period "+str(period)+", Group "+str(group))
- jTuple=("the name","the symbol","the atomic number","the Period and Group")
- for I in range(4):
- if I==0:
- end=" of the element "+name+"?:"
- rev=". What is that element's name?"
- elif I==1:
- end=" of the element with symbol "+symbol+"?:"
- rev=". What is that element's symbol?"
- elif I==2:
- end=" of the element with atomic number "+factTuple[2]+"?:"
- rev=". What is that element's atomic number?"
- else:
- end=" of the element in "+factTuple[3]+"?:"
- rev=". What Period and group is this element in?"
- for J in range(4):
- if I==J or J in bypass.get(I):
- continue
- print("What is "+jTuple[J]+end+factTuple[J]+rev)
- factSet ={("Aluminum" ,"Al",13,3,13),("Argon" ,"Ar",18,3,18),("Arsenic" ,"As",33,4,15),("Barium" ,"Ba",56,6, 2),
- ("Boron" ,"B" ,5 ,2,13),("Bromine" ,"Br",35,4,17),("Cadmium" ,"Cd",48,5,12),("Calcium" ,"Ca",20,4, 2),
- ("Carbon" ,"C" ,6 ,2,14),("Chlorine" ,"Cl",17,3,17),("Chromium" ,"Cr",24,4, 6),("Cobalt" ,"Co",27,4, 9),
- ("Copper" ,"Cu",29,4,11),("Fluorine" ,"F" ,9 ,2,17),("Gold" ,"Au",79,6,11),("Helium" ,"He",2 ,1,18),
- ("Hydogen" ,"H" ,1 ,1, 1),("Iodine" ,"I" ,53,5,17),("Iron" ,"Fe",26,4, 8),("Lead" ,"Pb",82,6,14),
- ("Lithium" ,"Li",3 ,2, 1),("Magnesium","Mg",12,3, 2),("Manganese","Mn",25,4, 7),("Mercury" ,"Hg",80,6,12),
- ("Neon" ,"Ne",10,2,18),("Nickel" ,"Ni",28,4,10),("Nitrogen" ,"N" ,7 ,2,15),("Oxygen" ,"O" ,8 ,2,16),
- ("Phosphorus","P" ,15,3,15),("Platinum" ,"Pt",78,6,10),("Potassium","K" ,19,4, 1),("Selenium","Se",34,4,16),
- ("Silicon" ,"Si",14,3,14),("Silver" ,"Ag",47,5,11),("Sodium" ,"Na",11,3, 1),("Sulfur" ,"S" ,16,16,3),
- ("Tin" ,"Sn",50,5,14),("Tianium" ,"Ti",81,6,13),("Uranium" ,"U" ,92,7, 0),("Zinc" ,"Zn",30,4,12)}
- choiceDict= dict()
- specialLists=((0,1,2),(0,3,4),(1,3,5),(2,4,5))
- import random
- for _ in range(40):
- temp=dict()
- seed=random.getrandbits(6)
- for i in range(4):
- subTemp=set()
- for j in range(4):
- k=0
- if i==j:
- continue
- if i<j:
- k=1
- include= (k+getSpecial(seed,(specialLists[i])[j-k]))%2
- if include ==0:
- subTemp.add(j)
- temp[i]=subTemp
- choiceDict[_]=temp
- print("Choices complete")
- _=0
- while len(factSet) !=0:
- printFacts(*((factSet.pop())+(choiceDict.pop(_),)))
- _+=1
Advertisement
Add Comment
Please, Sign In to add comment