Find at least three compile-time errors:


int x = 2
Print (x, squared is, x * x)
xcubed = x *** 3


Invalid syntax. int is a function and a type, but we never preface variables with their type. Python deals with that internally based on the assigned value.

print is never capitalized.

There is no such operator, ***

int(x) = 2

would also be invalid syntax since we cannot assign a value to a function.

A function call is in fact, a value. So assigning a value to a value would never work.

int(x) == 2


2 == int(x)

are both valid expressions since they compare two values.

x = int(2)

is also valid, but kind of moot.

type(x) is int

is also valid, and for the above assignment will return True.


Let’s not forget the missing quotes on the middle string in that argument list.

' squared is '


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.