print ( "-" * 30 )
print ( "注册界面" . center( 25 ) )
name= input ( "请输入您的注册用户名:" )
pwd= input ( "请输入您的注册密码:" )
print ( "恭喜您!注册成功!" )
print ( "-" * 30 )
print ( "-" * 30 )
print ( "登陆界面" . center( 25 ) )
sName= input ( "请输入您的登陆用户名:" )
sPwd= input ( "请输入您的登陆密码:" )
if ( sName== name and sPwd== pwd) :
print ( "登陆成功!" )
else :
print ( "登陆失败!" )
print ( "-" * 30 )
username = input ( '请输入你要注册的用户名:' )
password = input ( '请输入你要注册的密码:' )
with open ( 'list_of_info' , mode= 'w' , encoding= 'utf-8' ) as f:
f. write( '{}\n{}' . format ( username, password) )
print ( '恭喜您,注册成功' )
lis = [ ]
i = 0
while i < 3 :
usn = input ( '请输入你的用户名:' )
pwd = input ( '请输入你的密码:' )
with open ( 'list_of_info' , mode= 'r+' , encoding= 'utf-8' ) as f1:
for line in f1:
lis. append( line)
if usn == lis[ 0 ] . strip( ) and pwd == lis[ 1 ] . strip( ) :
print ( '登录成功' )
break
else : print ( '账号和密码错误' )
i+= 1
score= int ( input ( "请输入您的成绩:" ) )
if ( score< 0 or score> 100 ) :
print ( "对不起,您输入的成绩不符合要求!" )
elif ( score< 60 ) :
print ( "您的成绩为:不及格!" )
elif ( score< 70 ) :
print ( "您的成绩为:及格!" )
elif ( score< 80 ) :
print ( "您的成绩为:中等!" )
elif ( score< 90 ) :
print ( "您的成绩为:良好!" )
else :
print ( "您的成绩为:优秀!" )
mark = input ( "输入一个分数:" )
mark_num = int ( mark)
if mark_num >= 90 :
print ( "您的成绩是:优秀" )
elif mark_num >= 80 :
print ( "您的成绩是:良好" )
elif mark_num >= 70 :
print ( "您的成绩是:中等" )
elif mark_num >= 60 :
print ( "您的成绩是:及格" )
elif mark_num < 0 :
print ( "对不起,您输入的成绩成绩不符合要求" )
elif mark_num > 100 :
print ( "对不起,您输入的成绩成绩不符合要求" )
else :
print ( "您的成绩是:不及格" )
print ( "学生火车票优惠如下:" )
print ( "1、每年的1-3月和7-9月凭学生证可打5折。" )
print ( "2、10人(含10人)以上团购还可打9折。" )
price_all= float ( input ( "请输入单张火车票的全价:(1-1000):" ) )
isstu= input ( "是否为学生(Y/N):" )
month= int ( input ( "请输入当前月份(1-12):" ) )
num= int ( input ( "请输入需要订票的人数:" ) )
discount_rate= 1.0
if ( isstu== 'Y' or isstu== 'y' ) :
if ( ( month>= 1 and month<= 3 ) or ( month>= 7 and month<= 9 ) ) :
discount_rate*= 0.5
if ( num>= 10 ) :
discount_rate*= 0.9
print ( str . format ( "您应付的金额是:{0}" , price_all* discount_rate* num) )
price = int ( input ( "请输入单张火车票的全价:(1-1000) " ) )
isstudent = input ( "是否为学生:y/n " )
month = int ( input ( "请输入当前月份:1-12 " ) )
people_num = int ( input ( "请输入需要订票的人数: " ) )
total = price* 1.0
if isstudent == 'y' and ( ( month >= 1 and month <= 3 ) or ( month >= 7 and month <= 9 ) ) :
total = total * 0.5
total = total * people_num
if people_num >= 10 :
total = total * 0.9
print ( total)