Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

Dodonga

  • 2 years ago

Hey, i'm doing the optional exercises of hw1 of 6.189 ( A gentle Intro to programming with python) OPT.1 Zeller's Algorithm: I'm getting the following error when inputing X Y W Z: " Traceback (most recent call last): File "C:/Python26/MIT Homework/zellers.py", line 10, in <module> W= (13*A-1)/5 TypeError: unsupported operand type(s) for -: 'str' and 'int' "

  • This Question is Closed
  1. michaelseyne
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    There is a problem with the value type I believe. check with : W = (13 * int(A) - 1)/5 the function int() change a string into an integer. Can you show your code if you still have an issue ?

  2. Dodonga
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    thank you that was exactly it! i was using raw_input instead of int(input

  3. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy