name = input('请输入您的姓名:')
gender = input('请输入您的性别:')
age = input('请输入您的年龄:')
school = input('请输入您的学校:')
print('正在生成您的简历······')
print('*'*30)
print(' '*15 + '简历')
print('姓名:' + name + '\n' + '性别:' + gender + '\n' + '年龄:' + age + '\n' + '学校:' + school )
user_gender = input('请输入您的性别(F/M):')
i = 0
while i < 10:
if user_gender == 'F':
print('您是萌妹子学生')
break
elif user_gender == 'M':
print('您是糙汉子')
break
else:
print('您输入的不正确!')
user_gender = input('请重新输入您的性别(F/M):')
i += 1
if i == 10 :
print('机会已用完')
print('Game is over')
import time
gender = input('请输入您的性别(F/M): ')
age = int(input('请输入您的年龄: '))
title = '***您今年的运势***'
luck = '你会考上清华大学并找到一个男朋友'
i = 0
while i < 10 :
if gender == 'F' :
if 0 < age < 20 :
for i in range(10):
print('正在计算' + '.' * i)
time.sleep(2)
print(title)
print(luck)
break
else:
print('您还是个孩子吗?')
print('再见!')
break
elif gender == 'M':
if 0 < age < 20 :
print(title)
print(luck)
break
else:
print('您输错啦')
gender = input('请重新输入您的性别(F/M): ')
age = input('请重新输入您的年龄: ')
i = i + 1
print('Best luck for you in this year!')
import random
class Creature():
def __init__(self,hp,name):
self.hp = hp
self.name = name
def attack(self):
attack_value = random.randint(0,50) #攻击值
return attack_value
def being_attack(self,attack_value):
self.hp = self.hp - attack_value #血量值
def show_hp_status(self):
print("{}\'s hp is {}".format(self.name,self.hp*'*')) #打印血量值
def not_dead(self):
if self.hp <= 0:
return False
else:
return True
player = Creature(100, 'lixiang')
enemy = Creature(90, 'Enemy')
while player.not_dead() and enemy.not_dead():
player.show_hp_status()
enemy.show_hp_status()
user_input = input('Attack or Defence(A/B):')
if user_input == 'A':
player_attack_value = player.attack()
enemy_attack_value = enemy.attack()
player.being_attack(enemy_attack_value)
enemy.being_attack(player_attack_value)
elif user_input == 'B':
enemy_attack_value = enemy.attack() * 0.3
player.being_attack(enemy_attack_value)
if player.not_dead():
print('You are win!')
else:
print('You are loser!')