World's Best AI Learning Platform with profoundly Demanding Certification Programs
Designed by IITians, only for AI Learners.
Designed by IITians, only for AI Learners.
New to InsideAIML? Create an account
Employer? Create an account
Download our e-book of Introduction To Python
4.5 (1,292 Ratings)
559 Learners
Balasaheb Garule
2 years ago
static int n = 30; #static memory management in python
#dynamic memory management in python
int * d;
d = new int;
def display():
str1 = “insideaiml” # ref count + 1
print(str1)
display()
# ref count -1
# insideaiml is out of scope
import sys
str1 = 'hello'
print(sys.getrefcount(str1))
4
text = "Welcome to insideAIML"
print(text)
Welcome to insideAIML
del(text)
print(text)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'text' is not defined