Data Types
In C# or Java, You need to declare a variable specify them integer, string, and decimal. But in Python no need to specify. We can declare variables like
So, you don't need to declare variable types in python. This is an advantage in Python, But still have few Disadvantages too.Example: In my Python function
Python is not preventing you whether it is string or integer while you calling those functions, But in Python 3.5 we have a feature to add date types "type hinting" this will help you to guide while you writing code using IDE editors(it will show help text about variable type).
Demo
Integers and Floats
Defining integer and floats are very easy. You no need to bother about Postive value, Negative value or Decimal.
So, You don't need to worry about conversion.
Strings
We can use Strings to represent the text. The string can be defined by using Single quotes, Double quotes, and even Three quotes.
String format functions
Boolean and None
Boolean indicates TURE or FALSE values. Boolean most used in IF statements. You can convert a boolean value to an integer, The return statement "TRUE" consider as 1 and 0 consider as "FALSE".
Coming to "None" value, that something you'll assign a value later but not now. For these cases, you can assign a variable value as "None".
Comments
Post a Comment
Thank you :)