Swapnil Mishra
Swapnil Mishra

Reputation: 1

Python 3 "type" keyword throwing syntax error

When I define Position as mentioned below:

type Position = int * int

I get a run time error as shown below:

type Position = int * int
                ^
SyntaxError: invalid syntax

Can you please suggest how to fix this?

Upvotes: 0

Views: 221

Answers (1)

ppwater
ppwater

Reputation: 2277

In python you generally don't need to declare types

type is a function : type()

You can use it to return the type of the variable, but you don't have to(can't) declare a type for a variable.

So you can just do this:

Position = 1234 * 5678 # whatever integer you want

Upvotes: 1

Related Questions