salary=0
salaryArray=[]
loop=0
noYears=int(input("How many years do you want to do salaries for? "))
for i in range(0,noYears):
while loop==0:
print()
print("You can add multiple sources of income, one at a time")
salaryType=input("Do you want to put in your salary hourly or yearly? (h/y) ")
if salaryType=="y":
salarySection=float(input("What is your salary? "))
salary=salarySection+salary
else:
salaryHourly=float(input("What are you payed per hour? "))
salaryWeekly=float(input("How many hours per week will you work? "))
salaryYearly=float(input("How many weeks per year will you work? "))
print()
salarySection=salaryHourly*salaryWeekly*salaryYearly
salary=salary+salarySection
repeat=input("Do you wish to add another source of income? (y/n) ")
if repeat=="n":
print("This year's anual salary is", salary)
salaryArray.append(salary)
loop=1
由于某种原因for i in range(0,noYears)不起作用?它只是在完成一次后继续执行下一行代码 - 即使我将 noYears 的答案设置为 3。
任何人都知道为什么会这样,因为我看不出出了什么问题?:)
子衿沉夜
相关分类