0

When I try to run it, it comes up with an error message for creditsLeft = creditsDegree - creditsTaken. Says

unsupported operand type(s) for -: 'str' and 'str'

studentName = input('Enter student name. ')
degreeName = input('Enter degree name. ')
creditsDegree = input('Enter the number of credits required for degree. ')
creditsTaken = input('Enter credits taken so far. ')
creditsLeft = creditsDegree - creditsTaken 
print ('The student\'s name is'), studentName 
print ('The degree name is'), degreeName`enter code here`
print ('There are'), creditsLeft, ('credits left until graduation.')
Cyrus Mohammadian
  • 4,982
  • 6
  • 33
  • 62
Cary
  • 1
  • correct, for example: `animal = "cat" - "dog"` does not make sense – grochmal Sep 11 '16 at 21:15
  • You are trying to do arithmetic operations on strings. That will not work. – paisanco Sep 11 '16 at 21:16
  • That isn't the right way to use `print` in Python 3, either. It's a function, and the entire list of arguments needs to be inside one set of parentheses. – Ry- Sep 11 '16 at 21:18

1 Answers1

0

A string that happens to hold just digits, like "54", is not the same as the number 54. You need to convert, like this: int("54") or int(creditsDegree).

D-Von
  • 416
  • 2
  • 5