Day 2 of Learning Python started with len [Subscripting]
Imagine you want a Specific Letter of Any Unique word
For Example:
Sohm
From this word if you specifically want the letter " H " to be printed
you can simply use
print("Sohm[2]")
Output: h
You will be thinking why I used the number 2 not number 3 in brackets
The Reason python number starts from 0.
Types of Data Types
Strings:
print("232" + "341")
Output = 232341
Compiles every thing as Text
Integer=Whole Number:
print(123 + 543)
Output = 666
In between the number you can ADD, SUB, MULT, DIV, Expo.
Float - Floating point number
print(3.14)
It prints the decimal digits
Boolean
print(True)
print(False)
Mathematical Operators
Mathematical Operators are used in between the INTEGERS
WHICH ARE
ADDITION ---> +
SUBTRACTION ---> -
MULTIPLICATION ---> *
DIVISION (Decimal lvl) ---> /
DIVISION (Normal lvl) ---> //
Square or Exponential ---> **
There is Order of priority of Operators
PEDMAS
Parentheses, Exponents , Multiplication/Division ,ADD/SUB
Question of the Day
print(3 * 3 + 3 / 3 - 3)
Answer
print(3*(3+3)/3-3)
The part here was hard to figure out the priority of Operators
Top comments (0)