Python之流程管理

2021-10-21 19:20:21 字數 1418 閱讀 6651

條件判斷

if  條件表示式:

**塊else:

**塊

if  條件表示式:

**塊elif 條件表示式:

**塊elif 條件表示式:

......

else:

**塊

num = int(input("請輸入你的分數: "))

if num > 90:

print("優秀")

elif 80input()函式

while迴圈

while 條件表示式 :

**塊else:

**塊

while 表示式:

while 表示式:

**塊**塊

break和continue練習

#while迴圈的方式實現

while i<10:

j=1while j-求1000以內所有的水仙花數

num = int(input("請輸入100-1000的數值:"))

if num <=1000 and num >=100:

while n猜拳遊戲:

• 出拳 玩家:手動輸入 電腦:隨機輸入

• 判斷輸贏: 玩家獲勝 電腦獲勝 平局

import random

a=["石頭","剪刀","布"]

proper='''

請出拳(0/1/2)

(0)->石頭

(1)->剪刀

(2)->布'''

ind=int(input(proper))

palyer=a[ind]

complayer=random.choice(a)

all_list=[["石頭","剪刀"],["剪刀","布"],["布","石頭"]]

if palyer == complayer:

print("計算機出了,你出來,平局".format(complayer,palyer))

elif [complayer,palyer] in all_list:

print("計算機出了,你出了,你輸了".format(complayer,palyer))

else:

print("計算機出了,你出了,你贏了".format(complayer,palyer))

Scrum 之流程管理與程式設計管理

作為乙個master,除了編寫核心 之外,日常的工作基本上就是參與到流程管理和程式設計管理 流程管理所需的工作 前置條件 po完成需求編寫 工作內容 1.需求階段參與需求評審 2.在計畫會議上拆分任務,估計工時,排好優先順序,規劃好迭代 3.在開發階段記錄好花費,跟進體驗,進行code review...

python之流程控制

python中流程控制之if while for if 用來判斷條件是否符合,而後執行相應的操作 也可單獨使用if用來當滿足條件後執行某個操作 常見 if if else if elif else 典型的三目運算就是利用簡化if語句來獲取所需的值 用來結束迴圈操作 只結束距離自己最近的迴圈體 for...

python之流程控制

1.1.if語句語法 if 條件1 elif 條件2 else 條件3 1.2.if語句應用 登陸功能 name input please enter your name strip password input please enter your passwd strip if name weix...