This is a series of Python learning blog from parottosalna community by kaniyam foundation
This blog is based on this video Python | DataTypes, Variables, Constants | ParottaSalna"
To watch the full series check this youtube playlist
Contents
- Datatypes
- Variables
- Constants
- General Notes
Datatypes:
-
3 Types of Datatypes
- Numeric
- Integer
- Float / Decimal number
- Constants
- Text
- Boolean Types
- True, False, None
- Examples:
- is_active = true
- no_of_apples = none
- Numeric
Command to check the input type
type(26)
, Output will beint
datatypeEverything in Python Language is "Object"
Command to see functionalities of a Object
dir(26)
, Output show the available functionalities as a list.str
is the short form of String.-
Addition of Strings
-
"Vishal" + "J"
, The Output will beVishalJ
-
Variables:
Variable is a container to hold the values. And Variables will refer to Object / Value / Data.
-
There are some regulations in variable writing
- No symbol in-between
- Only start with Characters.
-
Command for Multiple assignment
-
name, age = "Vishal", 20
- Here is a example of tuple data type
-
-
Command to print the datatype in a program
print(type(name))
Running inspect - terminal option in browser to use JavaScript program
-
Commenting is useful to denote what is going in a program
- To comment single line
#
- To comment multiple lines
"""Hello world """
- To comment single line
Constants:
-
Types of Constants styles
- PascalCase
- Camelcase
- snake_case
Google Colab uses Jupiter notebook and into include automatic feature to print texts without print function
-
Book recommendation
- Byte of Python
Quiz's and Tasks for Practising
-
File handling commands
- Command to create a new file "file.txt" in F folder with program of print("Some content")
with open("file.txt", "w") as f: print("some content", file=f)
- Command to create a new file "file.txt" in F folder with program of print("Some content")
-
Concatenate make to add two strings as metioned in above before
-
print("Hello" + " World"
, the Output will beHello World
-
print("Hello" , "World")
, The Output will beHello World
. Here the the,
symbol will add some space between the words.
-
General Notes
By using Books you can use to self study and to advance
Note: We can paste images in Zoom chat option
To learn JavaScript one must have to know HTML
-
Forums to ask questions
- Stack overflow
- Chennai mailing list
- Tamil Linux Community
Top comments (0)