Skip to content

Fix Syntax Error in ID Comparison (Missing == in if statement) in Greenland Shark below the topic Integer Interning in Python #9

@M-Saneh

Description

@M-Saneh

Issue :
There's a syntax error in the code under the file/path: python/00_python_colab/02_data_types/.
Specifically, the comparison by ID is written as if(id(shark1_age) id(shark2_age)): which is missing ==.
It should be if (id(shark1_age) == id(shark2_age)): to work correctly.

Steps to Reproduce:

  1. Open the Colab notebook here: https://colab.research.google.com/drive/1LqRMqVAff7jR_Xha7arxwHkFdQL08xAu?usp=sharing
  2. Run the cell that contains the if(id(shark1_age) id(shark2_age)): line.
  3. Observe the SyntaxError: invalid syntax. Perhaps you forgot a comma?

Expected Behavior:

  • The code should compare the IDs of shark1_age and shark2_age without syntax errors.

Actual Behavior:

  • The code fails to run due to a missing == operator in the if statement.

Suggested Fix:
Replace it with :

 if id(shark1_age) == id(shark2_age):

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions