what is null in python?

0 votes
what is a null object in python?

what is the significance, how do i use it in a program?
Mar 8, 2019 in Python by Mohammad
• 3,210 points
61 views

2 answers to this question.

0 votes

as None is an object, you can test for it just like any other object.\

you can use it in a program like:

if (condition) is null :

answered Mar 8, 2019 by Waseem
• 4,520 points
0 votes

In python no primitive data types. python treats as object and the theres reference so there is on any explicit variable declaration like Java or c (String var_name=”Hello”; in java )it happens implicitly once you assign the object to reference then it looks appear like variable which of that object type so if you create reference and assign None(usually in other languages Null) it means your not referring any thing but when you create a empty string (by using ‘’ ) . in that case there is reference and string also there but the thing is that string length is zero which means that string nothing have to execute consider my follow code

type( string_var1)

<class 'NoneType'>

>>> print( string_var1)

None

>>> string_var2=''

>>> type( string_var2)

<class 'str'>

>>> len( string_var2)

0

answered Mar 13, 2019 by rajesh kumar
But aren't strings, integer, float etc., primitive datatypes in python?
Hello Sir. Can you please tell how your answer is relevant to this question?

Related Questions In Python

+2 votes
3 answers

what is the practical use of polymorphism in Python?

Polymorphism is the ability to present the ...READ MORE

answered Mar 31, 2018 in Python by anto.trigg4
• 3,440 points
1,891 views
+4 votes
7 answers
+1 vote
3 answers
0 votes
1 answer

What is the use of raw_input function in Python?

raw_input fuction is no longer available in ...READ MORE

answered May 2, 2018 in Python by aayushi
• 750 points
154 views
0 votes
1 answer

What is the flow control for “continue” in python?

This is the way "continue" statement works! You ...READ MORE

answered Jul 16, 2018 in Python by Priyaj
• 57,490 points
73 views
+1 vote
1 answer

What is the correct order to learn concepts in Python for machine learning?

Machine Learning is a vast domain. It ...READ MORE

answered Jul 25, 2018 in Python by Anmol
• 3,680 points
93 views
+1 vote
1 answer

How to check if a string is null in python

Try this: if cookie and not cookie.isspace(): # the ...READ MORE

answered Aug 20, 2018 in Python by Priyaj
• 57,490 points
6,056 views
+1 vote
1 answer

What is the function for Factorial in Python

Easiest way: math.factorial(x) (available in 2.6 and ...READ MORE

answered Aug 21, 2018 in Python by Priyaj
• 57,490 points

edited Aug 21, 2018 by Omkar 189 views
0 votes
1 answer

what is a type error in python?

you get a type error when you ...READ MORE

answered Mar 8, 2019 in Python by Waseem
• 4,520 points
117 views
0 votes
1 answer

what is an else if statement in python?

if condition:    statement elif condition:     statement #this is how you use ...READ MORE

answered Mar 15, 2019 in Python by Waseem
• 4,520 points
56 views