这里收集我那些失败的尝试😫
打印正三角形
row = int(input('Please enter the row number: '))
for i in range(row):
for j in range(row):
if j<row-i-1:
print(' ',end='')
else:
print(2*'*',end='')
print()
Please enter the row number: 5
**
****
******
********
**********
·
===============================================
一个同样失败的骰子游戏…
"""
玩家摇两个骰子,如果两个骰子数字相等,则玩家赢,若不相等,则继续
如果两个骰子数字相等,则庄家赢,若不相等,则继续
"""
from random import randint
money = 5
while money>0:
print('left: ')
needs_go_on = False
while True:
debt = 1
if debt <= money:
break
first1= randint(1,6)
first2= randint(1,6)
print(f'the result is {first1} and {first2}')
if first1==first2:
print('玩家胜!')
money += debt
else:
print('庄家胜!')
money -= debt
needs_go_on = True
while needs_go_on:
then1= randint(1,6)
then2= randint(1,6)
print(f'the result is {then1} and {then2}')
if then1==then2:
print('庄家胜!')
money -= debt
needs_go_on = False
print(' game over')
# edit
from random import randint
money = 5
while money>0:
print('left: ')
needs_go_on = False
while True:
debt = 1
if debt <= money:
break
first1= randint(1,6)
first2= randint(1,6)
print(f'the result is {first1} and {first2}')
if first1==first2:
print('玩家胜!')
money += debt
else:
print('庄家胜!')
money -= debt
needs_go_on = True
while needs_go_on:
then1= randint(1,6)
then2= randint(1,6)
print(f'the result is {then1} and {then2}')
if then1==then2:
print('庄家胜!')
money -= debt
needs_go_on = False
print(' game over')
·
·
==============================================
light
import os
import time
def main():
content = '王一博冲鸭!'
while True:
os.system('cls')
print(content)
time.sleep(0.2)
content = content[1:]+content[0]
main()
不要随便尝试,停不下来哎