Instance variable not changing

Instance variable not changing

The instance variable 'x' is not changing as expected after assignment.

The instance variable 'x' is not changing as expected after assignment.

This is my code:

class Foo:
def __init__(self, x=0):
    self.x = x
    if self.x>=100:
        self.x = int(str(self.x)[-2:])
    elif self.x<0:
        self.x = -1

p = Foo() print(p.x) p.x = 125 print(p.x) p.x = -945 print(p.x)

Expected:

0
25
-1

However I got this:

0
125
-945


Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Top Python Development Companies | Hire Python Developers

After analyzing clients and market requirements, TopDevelopers has come up with the list of the best Python service providers. These top-rated Python developers are widely appreciated for their professionalism in handling diverse projects. When...

Python GUI Programming Projects using Tkinter and Python 3

Python GUI Programming Projects using Tkinter and Python 3

Guide to Python Programming Language

Guide to Python Programming Language