所以我在这里有一个程序:https ://repl.it/@cooperl2/Find-Student-Info-V4-FINAL-STABLE
代码:
import datetime
import sys
def find_info():
first_name = input("What is your first name? ").lower()
sys.stdout.write("\033[F")
sys.stdout.write("\033[K")
last_name = input("What is your last name? ").lower()
sys.stdout.write("\033[F")
sys.stdout.write("\033[K")
grade = input("What grade are you in? ").lower()
grade = int(grade[0])
sys.stdout.write("\033[F")
sys.stdout.write("\033[K")
year = datetime.date.today().year
month = datetime.date.today().month
shift = 1 if datetime.date.today().month < 9 else 0
sys.stdout.write("\033[F")
sys.stdout.write("\033[K")
pin = input("What is your lunch pin / ID number? ")
sys.stdout.write("\033[F")
sys.stdout.write("\033[K")
grad_year = year + 13 - grade - shift
#this replaces the entire if statement in the V3 -- See V3 for details.
print("Hello there " + first_name+"!")
print("\n")
print("Your username is: " + last_name.lower() + first_name[0].lower() + str(grad_year)[2]+ str(grad_year)[3])
print("Your password is: " + first_name[0].lower() + last_name[0].lower() + pin + "hoh")
print("Your Email Address is: " + last_name.lower() + first_name[0].lower() + str(grad_year)[2]+ str(grad_year)[3] + "@learn.hohschools.org")
find_info()
但是,当我通过双击我的桌面在我的计算机上运行它时,它看起来像附加的图像。并且程序在第三个问题后退出并且没有完成。不知道为什么会这样以及为什么会有奇怪的符号。
