Write a program that repeatedly reads in a line containing a name might be any number of words an ID number 7 digits and a mark separated by semi-colons until the user chooses to quit After each line
name = "" id_num = "" mark = 0
while True: user_input = input("Type in name;id;mark or Q to stop: ") if user_input == "Q": break else: data = user_input.split(";") name = data[0] id_num = data[1] mark = int(data[2]) print("Name: {} ID: {} Mark: {}".format(name, id_num, mark))
原文地址: https://www.cveoy.top/t/topic/hw7I 著作权归作者所有。请勿转载和采集!