<jupyter_start><jupyter_text>BASIC PYTHON CONCEPTS<jupyter_code>print("Hello World!")<jupyter_output>Hello World!<jupyter_text>INDENTING<jupyter_code>a=int(input())
if(a>=5):
    print("greater than or equal to 5")
else:
    print("Smaller than 5")
a=int(input())
if(a>=5):
    pass
#print("greater than or equal to 5") -> this line will return an error
else:
    print("Smaller than 5")<jupyter_output>5<jupyter_text>KEYWORDS<jupyter_code>import keyword 
print(f'keyword are {len(keyword.kwlist)} key words')
for keywrd in keyword.kwlist:
    print(keywrd)<jupyter_output>keyword are 36 key words
False
None
True
__peg_parser__
and
as
assert
async
await
break
class
continue
def
del
elif
else
except
finally
for
from
global
if
import
in
is
lambda
nonlocal
not
or
pass
raise
return
try
while
with
yield<jupyter_text>SYNTAX AND SEMANTICS<jupyter_code>a=5
print(a)
#6=b -> This line will retuen in an error
print(b)<jupyter_output><empty_output><jupyter_text>LITERALS  1) STRING LITERALS<jupyter_code>a="Ikusei " 
print(a) 
print("Ikusei")<jupyter_output>Ikusei 
Ikusei<jupyter_text>CHARACTER LITERALS<jupyter_code>a="a" 
print(a)<jupyter_output>a<jupyter_text>2) NUMERIC LITERALS<jupyter_code>print(10)
print(0o456)
print(0X1A)
print(0b1101)
print(5.67)
print(6.022E3) 
print(2+3j)<jupyter_output>6022.0
(2+3j)<jupyter_text>3) BOOLEAN LITERALS<jupyter_code>a=(1==1)
b=(1==0)
print(a, b)<jupyter_output>True False<jupyter_text>4) NONE LITERALS<jupyter_code>print(None)<jupyter_output>None<jupyter_text>STRING AND STRING OPERATIONS  1) STRING DECLARATION<jupyter_code>a="Ikusei Rocks!"
print(a)<jupyter_output>Ikusei Rocks!<jupyter_text>2) INDEXING AND SLICING<jupyter_code>a="Ikusei Rocks!"
print(a[7])
print(a[3])
print(a[-1])
string="Ikusei Rocks!"
print(string[1:6])
print(string[:5])
print(string[5:])
print(string[-8:-1])<jupyter_output>kusei
Ikuse
i Rocks!
i Rocks<jupyter_text>3) STRING CONCATENATION<jupyter_code>a=" Ikusei "
b=" welcomes "
c=" you "
d=" to the family " 
print(a+b+c+d)<jupyter_output>Ikusei  welcomes  you  to the family<jupyter_text>4) BUILT-IN FUNCTION LEN()<jupyter_code>a="Ikusei "
b=" welcomes "
c=" you "
d=" to the family "
string=a+b+c+d
print("Length of the string is : ",len(string)) 
print(string)<jupyter_output>Length of the string is :  37
Ikusei  welcomes  you  to the family<jupyter_text>5) INDEX ERROR<jupyter_code>a="Ikusei"
#print(a[6])-> this line will return an error<jupyter_output><empty_output><jupyter_text>7) ESCAPING CHARACTERS<jupyter_code>txt = "She said \"Never let go\"." 
print(txt)<jupyter_output>She said "Never let go".<jupyter_text>8) The “in” syntax<jupyter_code>game = "Ikusei welcomes you to the family"
print("l" in game)
print("g" in game)<jupyter_output>True
False<jupyter_text>9) String method .lower()<jupyter_code>msge = "IKUSEI" 
print(msge.lower())<jupyter_output>ikusei<jupyter_text>10) String method .upper()<jupyter_code>msge = "ikusei" 
print(msge.upper())<jupyter_output>IKUSEI<jupyter_text>11) String method .title()<jupyter_code>film="the dark knight" 
print(film.title())<jupyter_output>The Dark Knight<jupyter_text>12) String method .split()<jupyter_code>msge="Ikusei welcomes you" 
print(msge.split()) 
print(msge.split("e"))<jupyter_output>['Ikusei', 'welcomes', 'you']
['Ikus', 'i w', 'lcom', 's you']<jupyter_text>13) String method .join()<jupyter_code>a="Ikusei" 
b="welcomes" 
c="you" 
msge="-".join([a,b,c]) 
print(msge)<jupyter_output>Ikusei-welcomes-you<jupyter_text>14) String method .split()<jupyter_code>msge=" Ikusei "
print(msge.split()) 
msge="....Ikusei......"
print(msge.split("."))<jupyter_output>['Ikusei']
['', '', '', '', 'Ikusei', '', '', '', '', '', '']<jupyter_text>15) String method replace<jupyter_code>msge="Ikusei welcomes you" 
print(msge.replace(" ","-")) 
print(msge.replace("e", "E"))<jupyter_output>Ikusei-welcomes-you
IkusEi wElcomEs you<jupyter_text>16)String method find()<jupyter_code>msge="Ikusei welcomes you " 
print(msge.find("e"))<jupyter_output>4<jupyter_text>17) String method .format()<jupyter_code>num=5
sq=num*num
print("Square of {} is {} ".format(num,sq))<jupyter_output>Square of 5 is 25<jupyter_text>2nd Method<jupyter_code>num=5
sq=num*num
print("Square of {number} is {squared_value} ".format(number=num,squared_value=sq))<jupyter_output>Square of 5 is 25<jupyter_text>MATH OPERATIONS  1) NUMERICAL OPERATORS  a) Addition and Subtraction<jupyter_code>a=5
b=7
print(a+b)<jupyter_output>12<jupyter_text>b)Division and multiplication<jupyter_code>a=12
b=8
print(12/8)
print(12*8)<jupyter_output>1.5
96<jupyter_text>c) Exponential(**) and Modulo(%) operator<jupyter_code>print(4**2)
print(4%2)
print(4%3)<jupyter_output>16
0
1<jupyter_text>d) Floor division<jupyter_code>print(10/3)
print(10//3)<jupyter_output>3.3333333333333335
3<jupyter_text>2) BIT-WISE OPERATOR  a) Python bitwise AND(&) operator<jupyter_code>print(4&8)
print(True&False) 
print(True &True) 
print(False&False)<jupyter_output>False
True
False<jupyter_text>b) Python OR(|) Operator<jupyter_code>print(6|7)
print(0b110|0b001)<jupyter_output>7
7<jupyter_text>c) Python bitwise XOR(^) Operator<jupyter_code>print(6^6)
print(6^3)<jupyter_output>0
5<jupyter_text>d) Python Bitwise 1’s Complement (~)<jupyter_code>print(~2) 
print(bin(2)) 
print(bin(-3))<jupyter_output>-3
0b10
-0b11<jupyter_text>e) Python Bitwise Left-Shift Operator (<<)<jupyter_code>print(bin(3))
print(3<<2) 
print(bin(12))<jupyter_output>0b11
12
0b1100<jupyter_text>f) Python Bitwise Right-Shift Operator (>>)<jupyter_code>print(bin(3)) 
print(3>>1) 
print(bin(1))<jupyter_output>0b11
1
0b1<jupyter_text>RELATIONAL OPERATORS<jupyter_code>print(5<2)
print(5>2)
print(5<=2)
print(5>=2)
print(5==2)
print(5!=2)<jupyter_output>False
True
False
True
False
True<jupyter_text>IN-PLACE OPERATORS  a) iadd()<jupyter_code>import operator 
a=operator.iadd(5,6) 
print(a)<jupyter_output>11<jupyter_text>b) isub()<jupyter_code>a=operator.isub(5,6) 
print(a)<jupyter_output>-1<jupyter_text>c) imul()<jupyter_code>a=operator.imul(5,6) 
print(a)<jupyter_output>30<jupyter_text>d) itruediv()<jupyter_code>a=operator.itruediv(30,6) 
print(a)<jupyter_output>5.0<jupyter_text>e) imod()<jupyter_code>a=operator.imod(30,6) 
print(a)<jupyter_output>0<jupyter_text>f) iconcat()<jupyter_code>a="Ikusei " 
b="Rocks!"
c=operator.iconcat(a,b)
print(c)<jupyter_output>Ikusei Rocks!<jupyter_text>Note:- You only need to import operator once  NUMERAL SYSTEMS  Conversions of different numeral systems<jupyter_code>a=15
print("Decimal value : ",a) 
print("Binary value : ",bin(a)) 
print("Octal value : ",oct(a)) 
print("Hexadecimal value : ",hex(a))
print(bin(56)) # decimal, to binary c 
print(bin(0x432)) # hexadecimal, to binary 
print (bin (0o743)) # octal. to binary]<jupyter_output>0b111000
0b10000110010
0b111100011
{'fraction_non_alphanumeric': 0.15822972172883362, 'fraction_numerical': 0.041000592066311424, 'mean_word_length': 9.145645645645645, 'pattern_counts': {'":': 0, '<': 141, '<?xml version=': 0, '>': 146, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '44', 'dir': 'jupyter-structured-clean-dedup', 'id': '636859', 'license': 'BSD-2-Clause', 'n_tokens_mistral': 3214, 'n_tokens_neox': 3023, 'n_words': 475, 'path': 'Module 1.ipynb', 'repo_name': 'rupinderjdn/Python-Baiscs', 'size': '6756'}