This is the second part of Learn Python from Zero to Hero, If you want to read part 1 click here.
So Let's start...
Comment in Python :
Python use the # (Hash) for comment, Python does not support multi line comment like C, C++ or Java. If you want to make more than one line comment, you should have to use # for each line from the starting point.
Comment Example :
# This is a First Comment.
# This is the Second Comment.
print("Hello Wolrd!")
# This is the Second Comment.
print("Hello Wolrd!")
Escape Sequence in Python :
Escape Sequence is a sequence of character, that does not represent itself. Let's see the Example.
- \' - Single Quotes
- \'' - Double Quotes
- \\ - Backslash
- \n - New Line
- \t - Tab
- \b - Backspace
Escape Sequence Example :
# Escape Sequence Example.
print("Hello World!")
print(" \' : \'Single Quotes\'")
print(" \" : \"Double Quotes\"")
print(" \\ : \\Backslash\\")
print(" \n : \nNew Line")
print(" \t : Tab")
print(" \b : Backspace")
print("Hello World!")
print(" \' : \'Single Quotes\'")
print(" \" : \"Double Quotes\"")
print(" \\ : \\Backslash\\")
print(" \n : \nNew Line")
print(" \t : Tab")
print(" \b : Backspace")
Emoji in Python :
Did you know ?, You can print emoji's using Python, Python have the special feature that you can print Emoji's in Python.
Print Emoji's :
# Print Emoji's Using unicode in Python.
print("Emoji Code : \'\U0001F602\'")
print("\U0001F602")
print("Emoji Code : \'\U0001F602\'")
print("\U0001F602")
If you want more Emoji's Code Please click here, But remember one thing, When you visit the given link you will get the unicodes something like " U+1F602 " than you have to change this unicode to " \U0001F602 ". (For Example : U+1F603 to \U0001F603, U+1F607 to \U0001F607 etc.).
Calculation in Python :
Python also support almost same time of calculations like - + (Addition), - (Subtractions), / (Float Division) or % (Reminder), But wait a second Python have something extra for you, YES extra.
Python support two type of division that is a float division and the second one is integer division. yes Float Division and Integer Division.
Python have a little advance features, that makes Python AWESOME, Yes awesome, Python also support a special calculation method that is Exponent , Yes EXPONENT, Do you want to know ?. if No, Skip It, But If Yes so let's make your face smiley.
Exponent means something like 2³ that means 2*2*2 that is 8, You can use this exponent direct in Python. Use the ** for Exponent.
Calculation Example :
# Calculation using Python.
print("Addition 3+2 : "3+2)
print("Subtraction 3-2 : "3-2)
print("Float Division 5/2 : "5/2)
print("Integer Division 5//2 : "5//2)
print("Reminder 5%2 : "5%2)
print("Exponent 4³ : "4**3)
print("Addition 3+2 : "3+2)
print("Subtraction 3-2 : "3-2)
print("Float Division 5/2 : "5/2)
print("Integer Division 5//2 : "5//2)
print("Reminder 5%2 : "5%2)
print("Exponent 4³ : "4**3)
Previous Topic : Part 1 Next Topic : Variables in Python
This is very useful and helpful Blog I loved it thanks Buddy.
ReplyDeleteYes @FuddiFake
DeleteNice nd Easy Tutorial Thanks
ReplyDelete