[Tutor] Beginner in need

Artur Sousa tucalipe at gmail.com
Mon Feb 11 19:46:25 CET 2008


Sorry... forgot to add the code...

2008/2/11, Artur Sousa <tucalipe at gmail.com>:
>
>
> Hi. Just started on programming, as well on Python. I'm having a little
> problem:
>



 What's the difference between:
>

for n in range(2, 10):
     for x in range(2, n):
         if n % x == 0:
             print n, 'equals', x, '*', n/x
             break
     else:
         # loop fell through without finding a factor
         print n, 'is a prime number'

and


for a in range(2, 10):
  for n in range(2, a):
  if a % n ==0:
   print a, 'equals', n, '*', a/n
   break
  else:
   print a, 'is a prime number'

each of the first spaces should be a "Tab".












-- 
Sorry for any inconvenience...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20080211/d52741b9/attachment.htm 


More information about the Tutor mailing list