Не удалось исправить переменные python - PullRequest
0 голосов
/ 24 января 2020

Так что я могу разделить переменную, которую я спрашивал ранее (спасибо). Но я полагаю, что я не поместил достаточно кода, так что вот и все, я получаю ошибки повсюду, но что бы я ни изменил, чтобы попытаться это исправить, я получаю тот же ответ. И да, я новичок в python, и это должно произойти через час.

# grade: The student's grade level  Ex. 12
# first: 1st six-weeks grade    Ex. 98
# second: 2nd six-weeks grade   Ex. 78
# third: 3rd six-weeks grade    Ex. 89
# num_exemptions: The number of exemptions that the student has already applied for this semester.  Ex. 3
# absences: The number of absences that the student has accrued for the semester.   Ex. 4
# tardies: The number of tardies that the student has accrued for the semester.   Ex. 5
# previously_taken_exemptions: Has the student taken an exemption for the same course in the fall. Ex. True
print('Enter your 1st 6 weeks grade. Ex. 98')
first = input()
print('Enter your 2nd 6 weeks grade. Ex. 78')
second = input()
print('Enter your 3rd 6 weeks grade. Ex. 89')
third = input()
print('Enter the number of exemptions that you have already applied for this semester. Ex. 3')
num_exemptions = input()
print('Enter your grade. Ex. 12')
grade = input()
print('Enter how many absences you have had this semester. Ex. 4')
absences = input()
print('Enter how many times you have been tardy this semester. Ex. 5')
tardies = input()
print('Have you taken and exemption for this course in the fall. Ex. no')
previously_taken_exemptions = input()
real_absences = float(tardies) // 3 + float(absences)
first = int(first)
sum = float(first) + float(second) + float(third)
average = sum/3
if(average >= 81 and average <= 100):
    print("Your Grade is an A")
elif(average >= 61 and average <= 80):
    print("Your Grade is an B")
elif(average >= 41 and average <= 60):
    print("Your Grade is an C")
elif(average >= 0 and average <= 40):
    print("Your Grade is an F")
else:
    print("You did something wrong, try again")
if float(grade == '11') and float(num_exemptions) <= 2 and float(real_absences) <= 3 and float(previously_taken_exemptions) == 'no' and float(average) >= 84:
    print('You are eligable!')
elif float(grade == '12') and float(num_exemptions) <= 4 and float(real_absences) <= 3 and float(previously_taken_exemptions) == 'no' and float(average) >= 84:
    print('You are eligable!')
elif float(grade == '9' or '10') and float(num_exemptions) <= 1 and float(real_absences) <= 3 and float(previously_taken_exemptions) == 'no' and float(average) >= 84:
    print('You are eligable!')
else:
    print('You are not eligable')

**

Ответы [ 2 ]

0 голосов
/ 24 января 2020

Вы можете превратить ваши строки в целые числа, используя int. Вы должны просто объявить целое число. вот пример

Tardies = int(“15”)
Absences = int(“5”)
real_absences = Tardies // 3 + Absences
0 голосов
/ 24 января 2020

Это потому что это строка, используйте:

real_absences = float(tardies) // 3 + float(absences)
...