Syntax coding problem, help pls

This is the place for queries that don't fit in any of the other categories.

Syntax coding problem, help pls

Postby NakamariFR » Sun Mar 30, 2014 12:13 am

Hello everybody
I'am trying to make a simple script (i'am new at this) and got a syntax problem
Anybody can help ?


I got this result when run

Code: Select all
C:\Python34\python.exe L:/
  File "L:/", line 17
    print cleDeControle('020860101347')
SyntaxError: invalid syntax

Process finished with exit code 1

Code: Select all
def cleDeControle(chars):
   factor = [7, 3, 1]
   result = 0
   for index, char in enumerate(chars.upper()):
      if char == '<':
         char = 0
      elif char >= 'A' and char <= 'Z':
         char = ord(char) - 55
         char = int(char)
      result += char * factor[index % 3]
   return result % 10
print cleDeControle('020860101347') # Affiche « 8 »
Last edited by stranac on Sun Mar 30, 2014 12:19 am, edited 1 time in total.
Reason: First post lock.
Posts: 1
Joined: Sun Mar 30, 2014 12:09 am

Re: Syntax coding problem, help pls

Postby stranac » Sun Mar 30, 2014 12:21 am

Are you using python 3?
If so, that line should be:
Code: Select all

(print is a function in python 3)

Also, please use code tags for tracebacks as well, the indentation is important there too.
Friendship is magic!

R.I.P. Tracy M. You will be missed.
User avatar
Posts: 1790
Joined: Thu Feb 07, 2013 3:42 pm

Return to General Coding Help

Who is online

Users browsing this forum: Bing [Bot] and 8 guests