You top-posted, and sent the mail to me privately (off-list). That's not how mailing lists work.

wrobl...@cmich.edu wrote:
Thank you for the reply.. I tried putting the print repr(n)
before I defined 'n' with raw_input. My script looks like
this------


def divisible(n):
   if n%3 == 0:
       print n, "is divisible by 3"
   else:
       print n, "is not divisible by 3"
n= raw_input("enter a number= ")
print repr(n)

print divisible(n)
In the shell, it gives me this error--------

Traceback (most recent call last):
  File "C:\Users\RY4N\Desktop\CMU
stuff\BIS228\is_divisible_by_3", line 11, in <module>
    print divisible(n)
  File "C:\Users\RY4N\Desktop\CMU
stuff\BIS228\is_divisible_by_3", line 4, in divisible
    if n%3 == 0:
TypeError: not all arguments converted during string formatting
----------
I don't understand what the problem is


You added the print, but you didn't look at the result, did you?

So, what was the repr(n) value? In particular, what is the type of n ? Is it what you expected?

DaveA

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to