This is my first official python program/scrip which I've done my self;) yay!:D. Im sure most of you guys know the 21 card trick where you guess what card a person is thinking of accurately.
anyway, I have trouble passing information between modules within modules and functions within functions.
this is what i have done so far but cant figure out how to get "list" from mod2.py into the main?. How would i go about doing this. And i know Ive over used the "modules" here, just wanted to get used to more structure is all:)
I know what to do, but just need help with the list thing. Please help.
-Thank you.
#'21 cards thing'
pile1=['hKing','s9','dJack','s10','dAce','c9','dQueen']
pile2=['h4','h9','dKing','hAce','sKing','cAce','cKing']
pile3=['s3','c4','c7','s5','c8','c6','s6']
import mod
def sort(name):
if name=='pile1':
mod.passing(pile2,pile1,pile3)
print (list)
if name=='pile2':
mod.passing(pile1,pile2,pile3)
if name=='pile3':
mod.passing(pile2,pile3,pile1)
#----------Main--------------------------------------------------------------------------------
print('Think of a card in one of the boxes')
print('\nPile1: ',pile1)
print('\nPile2: ',pile2)
print('\nPile3: ',pile3)
#--------------2nd---------------------------
print('\n\nOkay..So which is the card your thinking of in?')
ans=input('Pile :')
if 'pile1'in ans:
sort(pile1)
if 'pile2'in ans:
sort(pile2)
if 'pile3'in ans:
sort(pile3)
#'mod'
import mod2
def passing(t,m,b):
if m==pile1:
mod2.calc(pile2,m,pile3)
return list
if m==pile2:
mod2.calc=(pile1,m,pile3)
if m==pile3:
mod2.calc=(pile2,m,pile1)
#'mod2'
def calc(t,m,b):
list=t+m+b
return list