不一定要写两遍呀
n=0 while n!=-1: n=int(input())
这样写不就只写一遍吗或者这样也行
while 1: n=int(input()) if n<0: break
你爱写几遍写几遍,只要最后能实现题目要求的逻辑就行了