Text after "
From this formula:
I found out that it is possible to put some actions in a list , And by calling I am interested in doing this because I am writing a very small text based game right now part of the tutorial of the beginning But when I write what I think will give me the desired result ( That is, one of the tasks is being said and its string is printing. I get this result: all three functions Which is calling and printing. Can someone help me do this with the right syntax? Thank you. You call functions with brackets. Do you want to tell them later in the list and say: random.choice () , call one of them to generate a random event.
import random id func_test_1 (): print "this is func_test_1." Def func_test_2 (): print "this func_test_2 "DEF func_test_3 (): print". This is func_test_3 that "my_list = [func _test_1 (), func_test_2 (), func_test_3 ()] random.choice (my_list)
C: \ Windows \ System32 \ cmd.exe / c Dragon \ random_func.py This is func_test_1.It is func_test_2.It is func_test_3. Hit any key this window ... to stop
my_list = [func_test_1, func_test_2, func_test_3] random.choice (my_list) ()
Comments
Post a Comment