python开辟_本身开辟的一个小游戏   
               添加时间:2013-7-21 点击量: 
 
              先看看游戏的运行结果:




看完游戏的运行景象,你可能对游戏有了必然了懂得:
#运行游戏后,玩家起首要进行语音的选择,1选择英语,2选择汉语,其他则默认选择英语
#按照玩家选择的语音,进入不合的语音景象
#游戏规矩:玩家输入一个0-9的数字,体系按照玩家输入的数字,打印出数字的信息
#        若是玩家输入的数字局限不在0-9,则会打印出Error!
#退出游戏:游戏会跟着打印信息的完成提示退出游戏
代码项目组:
 1 #运行游戏后,玩家起首要进行语音的选择,1选择英语,2选择汉语,其他则默认选择英语
 2 #按照玩家选择的语音,进入不合的语音景象
 3 #游戏规矩:玩家输入一个0-9的数字,体系按照玩家输入的数字,打印出数字的信息
 4 #        若是玩家输入的数字局限不在0-9,则会打印出Error!
 5 #退出游戏:游戏会跟着打印信息的完成提示退出游戏
 6 language_option =  7     Language: Choose the language for System[OPTION]
 8             -1                    Choose English Language
 9             -2                    Choose Chinese Language
10             
11 enter_str = please enter an integer:
12 #开端游戏前的申明
13 en_game_start_str = You choose English language!,Now,Game Start!
14 cn_game_start_str = 你选择的中文模式!如今,开端游戏!
15 #游戏规矩
16 en_game_rule_str = you should enter a number that  0 to 9,then the \nSystem will print the information of the number
17 cn_game_rule_str = 你输入一个0-9的数字,体系会打印出该数字的信息
18 #停止游戏
19 en_game_over_str = Game Over!
20 cn_game_over_str = 游戏停止!
21 print(language_option)
22 number = int(input(enter_str))
23 
24 def print_info(num):
25     if num == 0:
26         print(0 zero 零)
27     elif num == 1:
28         print(1 one 壹)
29     elif num == 2:
30         print(2 three 贰)
31     elif num == 3:
32         print(3 three 叁)
33     elif num == 4:
34         print(4 four 肆)
35     elif num == 5:
36         print(5 five 伍)
37     elif num == 6:
38         print(6 six 陆)
39     elif num == 7:
40         print(7 seven 柒)
41     elif num == 8:
42         print(8 eight 捌)
43     elif num == 9:
44         print(9 nine 玖)
45     else:
46         print(Error!)
47 
48 def start_game(num):
49     if num == 1:
50         print(en_game_rule_str)
51     elif num == 2:
52         print(cn_game_rule_str)
53     else:
54         print(en_game_rule_str)
55     n = int(input(enter_str))
56     print_info(n)
57           
58 
59 if number == 1:
60     print(en_game_start_str)
61     start_game(1)
62     print(en_game_over_str)
63     exit()
64 elif number == 2:
65     print(cn_game_start_str)
66     start_game(2)
67     print(cn_game_over_str)
68     exit()
69 else:
70     print(en_game_start_str)
71     start_game(number)
72     print(en_game_over_str)
73     exit()

才刚开端接触python,志同道合的伴侣一路进修python....
我们永远不要期待别人的拯救,只有自己才能升华自己。自己已准备好了多少容量,方能吸引对等的人与我们相遇,否则再美好的人出现、再动人的事情降临身边,我们也没有能量去理解与珍惜,终将擦肩而过。—— 姚谦《品味》
                     
                  
     
  
 
    
    
先看看游戏的运行结果:




看完游戏的运行景象,你可能对游戏有了必然了懂得:
#运行游戏后,玩家起首要进行语音的选择,1选择英语,2选择汉语,其他则默认选择英语
#按照玩家选择的语音,进入不合的语音景象
#游戏规矩:玩家输入一个0-9的数字,体系按照玩家输入的数字,打印出数字的信息
# 若是玩家输入的数字局限不在0-9,则会打印出Error!
#退出游戏:游戏会跟着打印信息的完成提示退出游戏
代码项目组:
1 #运行游戏后,玩家起首要进行语音的选择,1选择英语,2选择汉语,其他则默认选择英语
2 #按照玩家选择的语音,进入不合的语音景象
3 #游戏规矩:玩家输入一个0-9的数字,体系按照玩家输入的数字,打印出数字的信息
4 # 若是玩家输入的数字局限不在0-9,则会打印出Error!
5 #退出游戏:游戏会跟着打印信息的完成提示退出游戏
6 language_option = 7 Language: Choose the language for System[OPTION]
8 -1 Choose English Language
9 -2 Choose Chinese Language
10
11 enter_str = please enter an integer:
12 #开端游戏前的申明
13 en_game_start_str = You choose English language!,Now,Game Start!
14 cn_game_start_str = 你选择的中文模式!如今,开端游戏!
15 #游戏规矩
16 en_game_rule_str = you should enter a number that 0 to 9,then the \nSystem will print the information of the number
17 cn_game_rule_str = 你输入一个0-9的数字,体系会打印出该数字的信息
18 #停止游戏
19 en_game_over_str = Game Over!
20 cn_game_over_str = 游戏停止!
21 print(language_option)
22 number = int(input(enter_str))
23
24 def print_info(num):
25 if num == 0:
26 print(0 zero 零)
27 elif num == 1:
28 print(1 one 壹)
29 elif num == 2:
30 print(2 three 贰)
31 elif num == 3:
32 print(3 three 叁)
33 elif num == 4:
34 print(4 four 肆)
35 elif num == 5:
36 print(5 five 伍)
37 elif num == 6:
38 print(6 six 陆)
39 elif num == 7:
40 print(7 seven 柒)
41 elif num == 8:
42 print(8 eight 捌)
43 elif num == 9:
44 print(9 nine 玖)
45 else:
46 print(Error!)
47
48 def start_game(num):
49 if num == 1:
50 print(en_game_rule_str)
51 elif num == 2:
52 print(cn_game_rule_str)
53 else:
54 print(en_game_rule_str)
55 n = int(input(enter_str))
56 print_info(n)
57
58
59 if number == 1:
60 print(en_game_start_str)
61 start_game(1)
62 print(en_game_over_str)
63 exit()
64 elif number == 2:
65 print(cn_game_start_str)
66 start_game(2)
67 print(cn_game_over_str)
68 exit()
69 else:
70 print(en_game_start_str)
71 start_game(number)
72 print(en_game_over_str)
73 exit()

才刚开端接触python,志同道合的伴侣一路进修python....
我们永远不要期待别人的拯救,只有自己才能升华自己。自己已准备好了多少容量,方能吸引对等的人与我们相遇,否则再美好的人出现、再动人的事情降临身边,我们也没有能量去理解与珍惜,终将擦肩而过。—— 姚谦《品味》



