Hardik Gajera
Hardik Gajera

Reputation: 25

How to indicate a long integer in Python

I have the following error in my Python code:

File "number.py", line 4
    print("Absolute value: "+str(abs(119L)))
                                        ^
SyntaxError: invalid syntax

What is the cause?

Upvotes: 2

Views: 11940

Answers (2)

Isac Moura
Isac Moura

Reputation: 6888

In Python you don't need to worry with long integers. You only need to declare an integer and forget the memory allocation and if the integer will be short or long.

Upvotes: 0

Ken Y-N
Ken Y-N

Reputation: 15009

There is no need to indicate long types as one might with C-type languages. Python 3.0 integers are always as big as necessary, so just drop the L.

Upvotes: 1

Related Questions