Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

bellcode / lesson2-3-1_DIY1

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 0
  • Merge Requests 0
  • Pipelines
  • Wiki
  • Snippets
  • Members
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Branches
  • Tags
  • Contributors
  • Graph
  • Compare
  • Charts
Commit 3fb3ac1c authored 4 years ago by BellCodeEditor's avatar BellCodeEditor
Browse files
Options
  • Browse Files
  • Download
  • Email Patches
  • Plain Diff

auto save

parent 23dfff73
Hide whitespace changes
Inline Side-by-side
Showing with 51 additions and 0 deletions
  • 1.py
  • computer.py
  • perfectGame.py
1.py 0 → 100644
View file @ 3fb3ac1c
a=input("请输入第一个数字:")
b=input("请输入第二个数字:")
int(a)
int(b)
print(str(a*b))
This diff is collapsed. Click to expand it.
computer.py 0 → 100644
View file @ 3fb3ac1c
# 玩家出拳
player = input("请出拳(石头/剪刀/布):")
print("玩家出拳:" + player)
# 计算机出拳
import random
list=["石头","剪刀","布"]
computer=random.choice(list)
print(computer)
\ No newline at end of file
This diff is collapsed. Click to expand it.
perfectGame.py 0 → 100644
View file @ 3fb3ac1c
# 完善游戏
# 写代码时习惯把需要导入的模块放在最前,老师可以和学生讲下,养成好习惯
# 前面练习时没关系,因为是正向设计目的是把代码写出来,最后整理下代码
import random
import time
print(".__ .__ .__ ")
print("| |__ ____ | | | | ____ ")
print("| | \_/ __ \| | | | / _ \ ")
print("| Y \ ___/| |_| |_( <_> )")
print("|___| /\___ >____/____/\____/ ")
print(" \/ \/ ")
print(" "+"欢迎来到我的游戏!!!")
time.sleep(1)
player = input("请出拳(石头/剪刀/布):")
print("∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞")
time.sleep(1)
print(" "+"3")
time.sleep(1)
print(" "+"2")
time.sleep(1)
print(" "+"1")
list = ["石头","剪刀", "布"]
computer = random.choice(list)
print("∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞")
print("玩家出拳:"+player)
print("计算机出拳:"+computer)
print("∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞")
if player in list:
if player == computer:
print("游戏平局,再来一次吧")
elif (player=="石头" and computer=="剪刀")or(player=="剪刀" and computer=="布")or(player=="布" and computer=="石头"):
print("恭喜,你赢了")
else:
print("很遗憾,你输了")
else:
print("输入错误")
This diff is collapsed. Click to expand it.
  • Write
  • Preview
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment