<jupyter_start><jupyter_text><jupyter_code>v = 1
print("The value of v is now", v)
!python -v
y = 1
if(y == 1):
  print("y still equals 1, I was just checking")
n = int(input())
if(n%2 == 0):
    print("Even")
else:
    print("Odd")
    

n = input()
if(n%2 == 0):
    print("Even")
elif:
    print("Odd")
a = 0
while (a < 9):
  a = a+1
  print(a)
i = 1
while(i < 6):
  i +=1
  if(i == 3):
    continue
    print(i)
a = int(input())
b = int(input())
if(a > b):
  print("a is grater than b")
else:
    print("b is greater than a")
  

x=int(input())
y=int(input())
if(x<y):
    print("greater number among the two entered is",y)
elif(x>y):
    print("greater number among the two entered is",x)
elif(x==y):
    print("both numbers are equal")

a=int(input())
b=int(input())
if a>=b:
    if a==b:
        print("Both number are equal")
        
    print(a)

else:
    print(b)
for x in range(7):
  print(x)
for x in range(2, 30, 2):
  print(x)
adj = ["red", "big","tasty"]
a = input("First Name = ")
b = input("Last Name = ")
c = int(input("Date of Birth = "))
d = int(input("Mobile Number = "))
print(a,b,c,d)



    
    
        
detail = input('First name, Last name, DOB, Mob No: ').split()
print(detail)

a = []
a = [5,10,15,20,25,30]
print("a[2]=", a[2])
s = 'Hello World!'
print(s)
s = "Kanishk Bhandari"
print (s[1:12])
string = "phython is AWsome"
capitalized_string = string.capitalize()
a = input("phython is Awsome")
if(a == 1):
  print(a.capitalize())
elif(a == 2):
    print(a.lower())
elif(a == 3):
      print(a.upper())
a = "good"
b = "morning"
c = "Kanishk"
d = "everyone should get vaccinated"
rbc=234
wbc=231.40
creatine=878987
final = "kanishks rbc count is {} , wbc count is {}"
print(a,b,c)
print(d[::-1])     #slicing
print(len(d))
print(d[:30:5])
print(d.find('vaccin'))
print("get vacc" in d)
print(reversed(d))
print(d.capitalize())
print(d.upper())
print(d.lower())
print(d.strip())
print(d.split())
print(final)
print(final.format(rbc,wbc,creatine))

FirstName=input()
SecondName=input()
Mobile=input()
Email=input()
print(type(FirstName))
print(type(SecondName))
print(type(Mobile))
if(type(Mobile) == int):
  print(Mobile)
elif(type(Mobile) != int):
  print("error")
print(type(Email))
if(d.find('@gmail.com')):
  print(Email)
else:
  print("error")
FirstName=input()
SecondName=input()
Mobile=input()
Email=input()
a=0
if(FirstName.isalpha()):
  a+=1
if(SecondName.isalpha()):
  a+=1
if(Mobile.isdigit()):
  a+=1
if(Email.find('@gmail.com')):
  a+=1
if(a==4):
  print("successful")
else:
  print("unsuccessful")
a = [5,10,15,20,25,30,35,40]
print(a[0:7:2])
a=[1,2,3]
a[2]=4
print(a)
List = []
List.append(1)
List.append(2)
print(List)
List.append((5,6))
List2=['mgr','smart']
List.append(List2)
print(List)
List = []
List.append(1)
List2=['abc','bcd']
List.append(List2)
List2.append(55)
print(List)
List.insert(3,12)
List2.insert(0,'mgr')
print(List)
List = [5,10,15,20,25]
List.copy()
print(List)
FirstName=input()
SecondName=input()
Mobile=input()
Email=input()
List=[FirstName, SecondName, Mobile, Email]
List.count(List)
if(List.count(List)==3):
  print("error")
else:
  print(List)
newList

List = [1,2,3,4,5]
List.index(5)

List = [1,2,3,4,5]
List.insert(10,5)
List = [1,2,3,4,5]
List.pop(2)
print(List)
List = [1,2,3,4,5]
List.remove(2)
print(List)
List = [1,3,4,2,5]
List.sort()
print(List)
def greet(name):
  print("Hello,"+name+".Good morning!")
greet("Kanishk")
def greet(name,name1):
  print("Hello,"+name+" & "+name1+".Good morning!")
greet("Kanishk","Mahesh")
def av(num):
  if num>=0:
    return num
  else:
    return -num
  print(av(-2))

def palindrome(x):
    if x==''.join(reversed(x)):
        print("this is a palindrome")
    else:
        print("not a palindrome")
word=input()
palindrome(word)
def my_func():
  x=10
  print("Value inside function:",x)
x=20
my_func()
print("Value outside function:",x)
x = "global"
def foo():
    print("x inside:",x)

foo()
print("x outside:",x)
def binary_search(item_list,item):
  first = 0
  last = len(item_list)-1
  found = False
  while(first<=last and not found):
    mid = (first+last)//2
    if item_list[mid] == item:
      found = True
    else:
      if item < item_list[mid]:
        last = mid-1
      else:
        first = mid+1
    return found
print(binary_search([1,2,3,5,8], 1))
print(binary_search([1,2,3,5,8], 3))
x = lambda a,b:a+b+10
print(x(23,2))
x = lambda a,b:a*b
print(x(23,2))
def myfunc(n):
  return lambda a : a // n
mydoubler = myfunc(5)
print(mydoubler(15))
ages = [5,12,17,18,24,32]
def myFunc(x):
  if x < 18:
    return False
  else:
    return True
adults = filter(myFunc, ages)
for x in adults:
  print(x)
def myfunc(n):
  return n.upper()
x = map(myfunc, ('cat', 'elephant', 'cherry'))

print(list(x))
!pip install pandas
!pip install numpy
f = open("mylib.py", "x")
import mylib
a = mylib.func1("Kanishk")
print(a)
import pandas as pd
s = pd.Series()
print(s)
import pandas as pd
import numpy as np
data = np.array(['a','b','c','d'])
s = pd.Series(data)
print (s)
import pandas as pd
import numpy as np
data = np.array(['a','b','c','d'])
data1 = np.array(['a1','b1','c1','d1'])
s = pd.Series(data,data1)
print (s)
import pandas as pd
import numpy as np
data = np.array(['a','b','c','d'])
s = pd.Series(data,index=[100,101,103,103])
print (s)
import pandas as pd
import numpy as np
data = {'a':2.,'b':4.,'c':6.}
s = pd.Series(data)
print (s)
import pandas as pd
s = pd.Series([1,2,3,4,5],index=['a','b','c','d','e'])
print(s[['a','c','d']])
import pandas as pd
df = pd.DataFrame()
print(df)
import pandas as pd
data = [1,2,3,4,5]
df = pd.DataFrame(data)
print(df.shape)
import pandas as pd
data = [["BOB",10],["ROB",15],["MARTIN",18]]
df = pd.DataFrame(data,columns=['Name','Age'])
print(df)
import pandas as pd
data = [["BOB",10],["ROB",15],["MARTIN",18]]
df = pd.DataFrame(data,columns=['Name','Age'],dtype=float)
print(df)
import pandas as pd
data = {'Name':['Tom', 'Jack', 'Steve', 'Ricky'],'Age':[28,34,29,42],'Weight':[53,65,48,95]}
df = pd.DataFrame(data)
print(df)
import pandas as pd
Name=input()
Age=int(input())
Weight=float(input())
df = pd.DataFrame(['Name','Age','Weight'],columns=['Feature'])
print(df)
name=input()
age=int(input())
weight=int(input())
b=[name,age,weight]
import pandas as pd
b=pd.DataFrame(b,columns=["Feature"])
print(b)
import pandas as pd
name=list(map(str,input().split()))
age=list(map(int,input().split()))
weight=list(map(int,input().split()))
data={'name':name,'age':age,'weight':weight}
df=pd.DataFrame(data)
print(df)
import pandas as pd
d={"name":[i for i in input().split()],"age":[int(i) for i in input().split()],"weight":[float(i) for i in input().split()]}
c=pd.DataFrame(d)
print(c)
import pandas as pd
data = [{'a':1,'b':2},{'a':5,'b':10,'c':20}]
df = pd.DataFrame(data)
print(df)
import pandas as pd
d = {'one': pd.Series([1,2,3], index=['a','b','c']),
'two': pd.Series([1,2,3,4], index=['a','b','c','d'])}
df = pd.DataFrame(d)
print(df)
import pandas as pd
d = {'one': pd.Series([1,2,3,4], index=['a','b','c','d']),
'two': pd.Series([1,2,3,4], index=['a','b','c','d'])}
df = pd.DataFrame(d)
df['four']=df['one']*df['two']
print(df)
import pandas as pd
d = {'one': pd.Series([1,2,3,4], index=['a','b','c','d']),
'two': pd.Series([1,2,3,4], index=['a','b','c','d'])}
df = pd.DataFrame(d)
print(df[2:4])
import pandas as pd
df = pd.DataFrame([[1,2],[3,4]], columns=['a','b'])
df2 = pd.DataFrame([[1,2],[3,4]], columns=['a','b'])
df = df.append(df2)
print(df)
import pandas as pd
df = pd.DataFrame([[1,2],[3,4]], columns=['a','b'])
df2 = pd.DataFrame([[1,2],[3,4]], columns=['a','b'])
df = df.append(df2)
df = df.drop(0)
print(df)
import pandas as pd
s = pd.read_csv("/content/temp.csv")
print(s)
import pandas as pd
url = "https://raw.githubusercontent.com/pandas-dev/pandas/master/doc/data/baseball.csv"
s = pd.read_csv(url)
print(s.shape)

import pandas as pd
url = "https://raw.githubusercontent.com/pandas-dev/pandas/master/doc/data/baseball.csv"
s = pd.read_csv(url)
print(s)
import pandas as pd
url = "https://raw.githubusercontent.com/pandas-dev/pandas/master/doc/data/baseball.csv"
s = pd.read_csv(url)
print(s.head(4))
import pandas as pd
url = "https://raw.githubusercontent.com/pandas-dev/pandas/master/doc/data/iris.data"
s = pd.read_csv(url)
print(s)
import json
import json
x = '{"name":"yash","age":30,"city":"KGF"}'
y = json.loads(x)                #convert into python dictionary from JSON
print(y)
import json
x = '{"name":"yash","age":30,"city":"KGF"}'
y = json.loads(x)
print(y["age"])
import json
x = {"name":"yash","age":30,"city":"KGF"}
y = json.dumps(x)                           #convert into JSON
print(y)
!pip install dnspython
!-m pip install pymongo[srv]


import pymongo
from pymongo import MongoClient


client = pymongo.MongoClient("mongodb+srv://KanishkBhandari:<EMAIL>ishk_23@<EMAIL>.mhgtp.mongodb.net/myFirstDatabase?retryWrites=true&w=majority")
db = client.test

db = client.get_database('iit_db')
records = db.guvi 
new = {'name' : "Kanishk",'DOB' : '23091997','dept' : "pharma"}
records.insert_one(new)
records.count_documents({})
new ={
      'Name' : input("Name:"),
      'Roll_No' : input("Roll_no.:"),
      'Address' : input("Address:")
}
records.insert_one(new)
print("Successfully printed=", new)

#23-OCT-2021
!pwd
!ls
!mkdir kanishk
myquery = {'name':'guvi'}
newvalues = {'$set':{'name':'iit'}}
records.update_one(myquery,newvalues)
for x in records.find():
  print(x)
new ={
    '_id' : 3,
    'name' : "guvi",
    'roll_no' : '23502362',
    'dept' : "efghiwel",
    'time' : "$currentDate": {type : 'timestamp' }
}
#using patron and address
new1={
    '_id' : "Kanishk",
    'name' : "<NAME>"
}
new2={
    'patron_id' : "Kanishk",
    'street' : "pipeline road",
    'city' : "bangalore",
    'state' : "Karnataka",
    'zip' : "560023"
}
records.insert_one(new1)
records.insert_one(new2)
#using embedded
new={
    '_id' : "Kanishk",
    'name' : "<NAME>",
    'address' : {
                'street' : "pipeline road",
                'city' : "bangalore",
                'state' : "Karnataka",
                'zip' : "560023"
    }
}
records.insert_one(new)
new={
    '_id' : input(),
    'name' : input(),
    'current_address' : [
                 {
                'street' : "pipeline road",
                'city' : "bangalore",
                'state' : "Karnataka",
                'zip' : "560023"
                 },
                 {
                    'email_id': "<EMAIL>",
                    'street' : "Vijayanagar",
                    'city' : "bangalore urban",
                    'state' : "Karnataka",
                    'zip' : "560023" 
                 }
    ]
}
records.insert_one(new)
publisher = {
             'name': "Guvi",
             'founded' : 2008,
             'location' : "Bangalore",
             'books' : [10,20]
            }
book1={
       'id': 10,
       'title': "Guvi-Data science",
       'author': ["Kanishk"],
       'published date': "2010-09-24",
       'pages': 216,
       'language': "English",
}
book2={
       'id': 20,
       'title': "Advanced Python",
       'author': "Kanishk,Bhandari",
       'published date': "2011-05-06",
       'pages': 305,
       'language': "English",
}
records.insert_one(publisher)
records.insert_one(book1)
records.insert_one(book2)

publisher = {
             '_id': 555,
             'name': "Guvi",
             'founded' : 2008,
             'location' : "Bangalore",
             'Book' : ["264310,23450"]
            }
book1={
       '_id': 264310,
       'title': "Guvi-Data science",
       'author': ["Kanishk"],
       'published date': "2010-09-24",
       'pages': 216,
       'language': "English",
       'publisher_id': 555,
}
book2={
       'id': 23450,
       'title': "Advanced Python",
       'author': "Kanishk,Bhandari",
       'published date': "2011-05-06",
       'pages': 305,
       'language': "English",
       'publisher_id': 555,
}
#records.insert_one(publisher)
#records.insert_one(book1)
records.insert_many([publisher,book1,book2])
book = int(input('Enter Book_id:'))
query = {'_id': Book}
for x in records.find(query):
  print('Title:',x['Title'])
  for y in records.find({'_id': x['publisher']}):
    print("Publisher:",y['name']+','+y['location']+','+str(y['founded']))
BankAccount = {
               '_id': 388538,
               'Name': input(),
               'AadharDetails': [
                 {
                     'AaadharID': input(),
                     'DOB': input(),
                     'street' : "pipeline road",
                     'city' : "bangalore",
                     'state' : "Karnataka",
                     'zip' : "560023"
                 },
                 {
                    'PANID': input(),
                    'street' : "Vijayanagar",
                    'city' : "bangalore urban",
                    'state' : "Karnataka",
                    'zip' : "560023" 
                 },
                {
                     "emailid" : input()
                 }

    ]
           
}
if(emailid.find('@gmail.com')):
  print('Bank Account Created Successfully')
else:
  print('Invalid emailid')

import pandas as pd
import numpy as np
list_1 = [1,2,3,4,5]
np.average(list_1)
np.var(list_1)
np.std(list_1)
import pandas as pd
import numpy as np
list_1 = [1,2,3,4,5]
n = len(list_1)
mean = sum(list_1)/n
dev = [(list_1 - mean) ** 2 for list_1 in list_1]
var = (sum(dev))//n
print(var)
import numpy as np
a = np.array([[1,2,3],
              [4,5,6]])
b = np.array([[7,8,9],
              [10,11,12]])
np.power(a,3)
np.shape(a)
np.shape(b)
np.add(a,b)
np.subtract(b,a)
np.divide(b,a)
np.multiply(a,b)
np.tan(a)
np.cos(b)
np.sin(a)
np.max(a)
np.min(b)
np.arange(1,5,1)
np.amin(a,1)
np.amax(b,0)
np.transpose(a)
np.average(a,0)
np.average(b,1)
np.sort(a)
!pip install matplotlib
import matplotlib
import matplotlib
print(matplotlib._version_)
from matplotlib import pyplot as plt
import numpy as np
x = [0,8]
y = [1,8]
plt.hist(x,y)
plt.title("Our First plot")
plt.xlabel("X-axis")
plt.ylabel("Y-axis")
plt.bar(x,y)
plt.plot(x,y,'red')
plt.scatter(x,y)
from matplotlib import pyplot as plt
import numpy as np
ypoints = ([3,8,1,10])
plt.plot(ypoints, marker = 'o')
plt.show()
from matplotlib import pyplot as plt
import numpy as np
ypoints = ([3,8,1,10])
plt.plot(ypoints, marker = 'o', ms=10, mec = 'r', mfc = 'g', linestyle = '-.', color = 'm', linewidth = '4')
plt.show()
from matplotlib import pyplot as plt
import numpy as np
y1 = np.array([3,8,1,10])
y2 = np.array([6,2,7,11])
plt.plot(y1, marker = 'o', ms=10, mec = 'r', mfc = 'g', linestyle = '-.', color = 'm', linewidth = '4')
plt.plot(y2, marker = '*', ms=11, mec = 'g', mfc = 'r', linestyle = '--', color = 'y', linewidth = '4')
plt.show()
from matplotlib import pyplot as plt
import numpy as np
x = np.array([180,185,190,195,200])
y = np.array([180,185,190,195,200])
y1 = np.array([183,196,180,180,199])
y2 = np.array([184,192,181,187,198])
plt.plot(y1, marker = 'o', ms=10, mec = 'r', mfc = 'g', linestyle = '-.', color = 'g', linewidth = '2')
plt.plot(y2, marker = '*', ms=11, mec = 'g', mfc = 'r', linestyle = '--', color = 'r', linewidth = '2')
plt.title("Sports Watch Data")
plt.xlabel("Average Pluse")
plt.ylabel("Calorie Burnage")
plt.grid()
plt.show()
from matplotlib import pyplot as plt
import numpy as np
x = np.array(["A","B","C","D","E"])
y = np.array([3,8,10,4,15])
plt.bar(x,y)
from matplotlib import pyplot as plt
import numpy as np
x = np.array(["A","B","C","D","E"])
y = np.array([3,8,10,4,15])
plt.bar(x,y, width=0.1)
from matplotlib import pyplot as plt
import numpy as np
x = np.array(["A","B","C","D","E"])
y = np.array([3,8,10,4,15])
plt.barh(x,y, height=0.1)
from matplotlib import pyplot as plt
import numpy as np
mylabels = np.array(["Apple","Banana","Cherry","Dates","E"])
y = np.array([3,8,10,4,15])
plt.pie(y, labels=mylabels, startangle=180)
plt.show()
from matplotlib import pyplot as plt
import numpy as np
mylabels = np.array(["Apple","Banana","Cherry","Dates","E"])
y = np.array([3,8,10,4,15])
myexplode = [0, 0, 0, 0, 0.5]
plt.pie(y, labels=mylabels, explode=myexplode)
plt.show()
from matplotlib import pyplot as plt
import numpy as np
mylabels = np.array(["Apple","Banana","Cherry","Dates","E"])
y = np.array([3,8,10,4,15])
myexplode = [0, 0, 0, 0, 0.5]
mycolors = ["red","orange","green","blue","black"]
plt.pie(y, labels=mylabels, explode=myexplode, colors=mycolors)
plt.show()
from matplotlib import pyplot as plt
import numpy as np
mylabels = np.array(["Apple","Banana","Cherry","Dates","E"])
y = np.array([3,8,10,4,15])
myexplode = [0, 0, 0, 0, 0.5]
mycolors = ["red","orange","green","blue","black"]
plt.pie(y, labels=mylabels, explode=myexplode, colors=mycolors)
plt.legend(title="Fruit Chart")
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.2147165979812459, 'fraction_numerical': 0.042346055067789524, 'mean_word_length': 3.686258046459558, 'pattern_counts': {'":': 13, '<': 16, '<?xml version=': 0, '>': 14, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '360154', 'license': 'Unlicense', 'n_tokens_mistral': 7145, 'n_tokens_neox': 6710, 'n_words': 1446, 'path': 'GUVIclasses.ipynb', 'repo_name': 'KanishkBhandari97/mypractice', 'size': '16780'}