Uploading Notes
This commit is contained in:
parent
19d1e013c6
commit
0ca8d38e43
Binary file not shown.
10
ML/ExerciseNameValidation-200808-183418.py
Normal file
10
ML/ExerciseNameValidation-200808-183418.py
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
full_name='Ra'
|
||||||
|
|
||||||
|
if len(full_name)<3:
|
||||||
|
print("Name is too short")
|
||||||
|
|
||||||
|
elif len(full_name) > 50:
|
||||||
|
print("Name is very long")
|
||||||
|
|
||||||
|
else:
|
||||||
|
print("Name is validated")
|
32
ML/FlipkartTracker-200910-134031.py
Normal file
32
ML/FlipkartTracker-200910-134031.py
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
import requests
|
||||||
|
from bs4 import BeautifulSoup
|
||||||
|
|
||||||
|
URL = "https://www.flipkart.com/samsung-galaxy-m31-ocean-blue-64-gb/p/itm1268b57512fb8?pid=MOBFPNPS6GTGZHE4&lid=LSTMOBFPNPS6GTGZHE4MR8YKS&marketplace=FLIPKART&srno=s_1_1&otracker=AS_Query_HistoryAutoSuggest_1_3_na_na_na&otracker1=AS_Query_HistoryAutoSuggest_1_3_na_na_na&fm=SEARCH&iid=7ed64fb0-2813-4eba-a188-31510a3200d9.MOBFPNPS6GTGZHE4.SEARCH&ppt=sp&ppn=sp&ssid=mfr9comyls0000001599722937598&qH=72c0d4f69be69bf9"
|
||||||
|
|
||||||
|
headers = {
|
||||||
|
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36 OPR/70.0.3728.106"
|
||||||
|
}
|
||||||
|
page = requests.get(URL, headers=headers)
|
||||||
|
soup = BeautifulSoup(page.content, 'html.parser')
|
||||||
|
|
||||||
|
print(page)
|
||||||
|
|
||||||
|
|
||||||
|
price3 = soup.find("div", {"class": "_1vC4OE _3qQ9m1"})
|
||||||
|
print (price3)
|
||||||
|
print(price3.string)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
16
ML/GreaterThanOperatorProgram-200808-183418.py
Normal file
16
ML/GreaterThanOperatorProgram-200808-183418.py
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
my_marks=35
|
||||||
|
|
||||||
|
if my_marks>35:
|
||||||
|
print("Congrats you have passed")
|
||||||
|
|
||||||
|
if my_marks < 35:
|
||||||
|
print("Sorry you failed")
|
||||||
|
|
||||||
|
if my_marks == 35:
|
||||||
|
print("You are on the border")
|
||||||
|
|
||||||
|
if my_marks != 100:
|
||||||
|
print("You didnt score 100%")
|
||||||
|
|
||||||
|
if my_marks >= 35:
|
||||||
|
print("Congrats you have just passed")
|
15
ML/GuessingGame-200808-185627.py
Normal file
15
ML/GuessingGame-200808-185627.py
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
secret_number = 9
|
||||||
|
|
||||||
|
guess_count = 0
|
||||||
|
guess_limit = 3
|
||||||
|
|
||||||
|
while guess_count < guess_limit :
|
||||||
|
guess= int(input('Guess: '))
|
||||||
|
guess_count+=1
|
||||||
|
if guess == secret_number:
|
||||||
|
print('You won !')
|
||||||
|
break
|
||||||
|
|
||||||
|
else:
|
||||||
|
print('Sorry you guessed all wrong !')
|
||||||
|
|
11
ML/HeightConverterProgram-200808-184542.py
Normal file
11
ML/HeightConverterProgram-200808-184542.py
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#Start with input function
|
||||||
|
distance = int(input('Input the distance travelled: '))
|
||||||
|
unit = input('input unit type i.e K for Kms - M for Miles :')
|
||||||
|
|
||||||
|
if unit.upper() == "K":
|
||||||
|
converted = distance/1.609
|
||||||
|
print(f"You have gone {converted} miles")
|
||||||
|
|
||||||
|
else:
|
||||||
|
converted = distance*1.609
|
||||||
|
print(f"You have gone {converted} kms")
|
75
ML/Index-201106-105925.ipynb
Normal file
75
ML/Index-201106-105925.ipynb
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
{
|
||||||
|
"cells": [
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"# Welcome to Jupyter!"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 3,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"math.sqrt(4) = 2.0\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"import math\n",
|
||||||
|
"\n",
|
||||||
|
"print(\"math.sqrt(4) = \" + str(math.sqrt(4)))"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"### Printing hello world"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 6,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"Hello world\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"print(\"Hello world\")"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"kernelspec": {
|
||||||
|
"display_name": "Python 3",
|
||||||
|
"language": "python",
|
||||||
|
"name": "python3"
|
||||||
|
},
|
||||||
|
"language_info": {
|
||||||
|
"codemirror_mode": {
|
||||||
|
"name": "ipython",
|
||||||
|
"version": 3
|
||||||
|
},
|
||||||
|
"file_extension": ".py",
|
||||||
|
"mimetype": "text/x-python",
|
||||||
|
"name": "python",
|
||||||
|
"nbconvert_exporter": "python",
|
||||||
|
"pygments_lexer": "ipython3",
|
||||||
|
"version": "3.6.11"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nbformat": 4,
|
||||||
|
"nbformat_minor": 2
|
||||||
|
}
|
BIN
ML/LinearRegressionIntro-201106-111306.pdf
Normal file
BIN
ML/LinearRegressionIntro-201106-111306.pdf
Normal file
Binary file not shown.
56
ML/ListFunctions-200808-180422.py
Normal file
56
ML/ListFunctions-200808-180422.py
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
heroes = ["Rajkumar", "ShankarNag", "Vishnu", "Ambi", "Darshan", "Punith"]
|
||||||
|
|
||||||
|
# add , remove, check for existence
|
||||||
|
|
||||||
|
print(heroes)
|
||||||
|
|
||||||
|
# add at the end
|
||||||
|
heroes.append("AnanthNag")
|
||||||
|
|
||||||
|
# insert at a certain position - other values gets pushed by 1 index
|
||||||
|
heroes.insert(2, "Uppi")
|
||||||
|
|
||||||
|
# remove elements
|
||||||
|
heroes.remove("Punith")
|
||||||
|
|
||||||
|
print(heroes)
|
||||||
|
|
||||||
|
# clear - give an empty list
|
||||||
|
heroes.clear()
|
||||||
|
|
||||||
|
# pop an item out of the list - last element
|
||||||
|
heroes.pop()
|
||||||
|
|
||||||
|
# check if element is in the list - returns the index if exists else throws error
|
||||||
|
print(heroes.index("Ambi"))
|
||||||
|
|
||||||
|
# not in the list
|
||||||
|
# print(heroes.index("Sadhu"))
|
||||||
|
|
||||||
|
# also can check using in operator - avoids error
|
||||||
|
print("Sadhu" in heroes)
|
||||||
|
|
||||||
|
# count the number of occurrences
|
||||||
|
print(heroes.count(("Ambi")))
|
||||||
|
|
||||||
|
# sort
|
||||||
|
heroes.sort()
|
||||||
|
|
||||||
|
numbers = [3, 44, 12, 98, 25, 34]
|
||||||
|
numbers.sort()
|
||||||
|
print(numbers)
|
||||||
|
|
||||||
|
# reverse
|
||||||
|
numbers.reverse()
|
||||||
|
print(numbers)
|
||||||
|
|
||||||
|
heroes = ["Rajkumar", "ShankarNag", "Vishnu", "Ambi", "Darshan", "Punith"]
|
||||||
|
numbers = [3, 44, 12, 98, 25, 34]
|
||||||
|
|
||||||
|
# copy function
|
||||||
|
numbers2 = numbers.copy()
|
||||||
|
print(numbers2)
|
||||||
|
|
||||||
|
# extend
|
||||||
|
heroes.extend(numbers)
|
||||||
|
print(heroes)
|
56
ML/ListFunctions-200808-182054.py
Normal file
56
ML/ListFunctions-200808-182054.py
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
heroes = ["Rajkumar", "ShankarNag", "Vishnu", "Ambi", "Darshan", "Punith"]
|
||||||
|
|
||||||
|
# add , remove, check for existence
|
||||||
|
|
||||||
|
print(heroes)
|
||||||
|
|
||||||
|
# add at the end
|
||||||
|
heroes.append("AnanthNag")
|
||||||
|
|
||||||
|
# insert at a certain position - other values gets pushed by 1 index
|
||||||
|
heroes.insert(2, "Uppi")
|
||||||
|
|
||||||
|
# remove elements
|
||||||
|
heroes.remove("Punith")
|
||||||
|
|
||||||
|
print(heroes)
|
||||||
|
|
||||||
|
# clear - give an empty list
|
||||||
|
heroes.clear()
|
||||||
|
|
||||||
|
# pop an item out of the list - last element
|
||||||
|
heroes.pop()
|
||||||
|
|
||||||
|
# check if element is in the list - returns the index if exists else throws error
|
||||||
|
print(heroes.index("Ambi"))
|
||||||
|
|
||||||
|
# not in the list
|
||||||
|
# print(heroes.index("Sadhu"))
|
||||||
|
|
||||||
|
# also can check using in operator - avoids error
|
||||||
|
print("Sadhu" in heroes)
|
||||||
|
|
||||||
|
# count the number of occurrences
|
||||||
|
print(heroes.count(("Ambi")))
|
||||||
|
|
||||||
|
# sort
|
||||||
|
heroes.sort()
|
||||||
|
|
||||||
|
numbers = [3, 44, 12, 98, 25, 34]
|
||||||
|
numbers.sort()
|
||||||
|
print(numbers)
|
||||||
|
|
||||||
|
# reverse
|
||||||
|
numbers.reverse()
|
||||||
|
print(numbers)
|
||||||
|
|
||||||
|
heroes = ["Rajkumar", "ShankarNag", "Vishnu", "Ambi", "Darshan", "Punith"]
|
||||||
|
numbers = [3, 44, 12, 98, 25, 34]
|
||||||
|
|
||||||
|
# copy function
|
||||||
|
numbers2 = numbers.copy()
|
||||||
|
print(numbers2)
|
||||||
|
|
||||||
|
# extend
|
||||||
|
heroes.extend(numbers)
|
||||||
|
print(heroes)
|
48
ML/ListsProgram-200808-180223.py
Normal file
48
ML/ListsProgram-200808-180223.py
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
cricketers = ["Sachin", "Dhoni", "Virat"]
|
||||||
|
|
||||||
|
# one value vs multiple value
|
||||||
|
# access these values
|
||||||
|
|
||||||
|
# what we can put inside a List - strings,number,boolean
|
||||||
|
|
||||||
|
cricketers2 = ["Sachin", "Dhoni", "Virat", 1, True]
|
||||||
|
|
||||||
|
# how to access individual elements of this list
|
||||||
|
|
||||||
|
print(cricketers2)
|
||||||
|
|
||||||
|
# lets say access specific value - index
|
||||||
|
cricketers3 = ["Sachin", "Dhoni", "Virat"]
|
||||||
|
# 0 1 2
|
||||||
|
print(cricketers3[0])
|
||||||
|
|
||||||
|
# we can also access back of the list
|
||||||
|
cricketers4 = ["Sachin", "Dhoni", "Virat"]
|
||||||
|
# -3 -2 -1
|
||||||
|
|
||||||
|
# keep in mind index position 0 vs -1 from back
|
||||||
|
|
||||||
|
print(cricketers4[-3])
|
||||||
|
|
||||||
|
# last 2 elements in the list
|
||||||
|
|
||||||
|
print(cricketers4[1:])
|
||||||
|
|
||||||
|
# range - add 3 more to list
|
||||||
|
cricketers5 = ["Sachin", "Dhoni", "Virat", "Dravid", "Amarnath", "Sehwag"]
|
||||||
|
|
||||||
|
print(cricketers5[1:4])
|
||||||
|
|
||||||
|
# beginning to end of list
|
||||||
|
print(cricketers5[:])
|
||||||
|
|
||||||
|
# original list is not modified
|
||||||
|
print(cricketers5[1:4])
|
||||||
|
print(cricketers5)
|
||||||
|
|
||||||
|
# Modify a list
|
||||||
|
cricketers6 = ["Sachin", "Dhoni", "Virat", "Dravid", "Amarnath", "Sehwag"]
|
||||||
|
|
||||||
|
cricketers6[2] = "Rohit"
|
||||||
|
print(cricketers6)
|
||||||
|
|
9
ML/LogicalAndProgram-200808-183018.py
Normal file
9
ML/LogicalAndProgram-200808-183018.py
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
has_learned_python = True
|
||||||
|
has_degree = True
|
||||||
|
|
||||||
|
if has_learned_python and has_degree:
|
||||||
|
print("Shortlist Candidate for interview")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
5
ML/LogicalNot-200808-183018.py
Normal file
5
ML/LogicalNot-200808-183018.py
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
has_learned_python = True
|
||||||
|
is_working_currently = True
|
||||||
|
|
||||||
|
if has_learned_python and not is_working_currently:
|
||||||
|
print("Shortlist Candidate for interview")
|
9
ML/LogicalOrProgram-200808-183018.py
Normal file
9
ML/LogicalOrProgram-200808-183018.py
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
has_learned_python = True
|
||||||
|
has_degree = True
|
||||||
|
|
||||||
|
if has_learned_python or has_degree:
|
||||||
|
print("Shortlist Candidate for interview")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
BIN
ML/ML.docx
Normal file
BIN
ML/ML.docx
Normal file
Binary file not shown.
BIN
ML/MLLifeCycle-201105-123333_2.pdf
Normal file
BIN
ML/MLLifeCycle-201105-123333_2.pdf
Normal file
Binary file not shown.
BIN
ML/NLP.docx
Normal file
BIN
ML/NLP.docx
Normal file
Binary file not shown.
65
ML/PriceTracker-200907-163352.py
Normal file
65
ML/PriceTracker-200907-163352.py
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
import requests
|
||||||
|
from bs4 import BeautifulSoup
|
||||||
|
|
||||||
|
products_to_track = [
|
||||||
|
{
|
||||||
|
"product_url": "https://www.amazon.in/Samsung-Galaxy-Ocean-Blue-Storage/dp/B07HGJKDQL?ref_=Oct_s9_apbd_orecs_hd_bw_b1yBwdz&pf_rd_r=55ER8G6AQWTCQRMB1Q3V&pf_rd_p=94baa1a4-2f06-554d-82db-8b9866e02276&pf_rd_s=merchandised-search-10&pf_rd_t=BROWSE&pf_rd_i=1805560031&tag=coa_in-21",
|
||||||
|
"name": "Samsung M31",
|
||||||
|
"target_price": 16000
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"product_url": "https://www.amazon.in/Test-Exclusive-668/dp/B07HGH88GL/ref=psdc_1805560031_t1_B07HGJKDQL",
|
||||||
|
"name": "Samsung M21 6GB 128RAM",
|
||||||
|
"target_price":16000
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"product_url": "https://www.amazon.in/Test-Exclusive-553/dp/B0784D7NFQ/ref=sr_1_12?crid=2RE70JAZ07V4M&dchild=1&keywords=redmi+note+9&qid=1599449618&s=electronics&sprefix=redmi+%2Celectronics%2C-1&sr=1-12",
|
||||||
|
"name": "Redmi Note 9 Pro",
|
||||||
|
"target_price":17000
|
||||||
|
},{
|
||||||
|
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
def give_product_price(URL):
|
||||||
|
headers = {
|
||||||
|
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36 OPR/70.0.3728.106"
|
||||||
|
}
|
||||||
|
page = requests.get(URL, headers=headers)
|
||||||
|
soup = BeautifulSoup(page.content, 'html.parser')
|
||||||
|
|
||||||
|
product_price = soup.find(id="priceblock_dealprice")
|
||||||
|
if (product_price == None):
|
||||||
|
product_price = soup.find(id="priceblock_ourprice")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return product_price.getText()
|
||||||
|
|
||||||
|
result_file = open('my_result_file.txt','w')
|
||||||
|
|
||||||
|
try:
|
||||||
|
for every_product in products_to_track:
|
||||||
|
product_price_returned = give_product_price(every_product.get("product_url"))
|
||||||
|
print(product_price_returned + " - " + every_product.get("name"))
|
||||||
|
|
||||||
|
my_product_price = product_price_returned[2:]
|
||||||
|
my_product_price = my_product_price.replace(',', '')
|
||||||
|
my_product_price = int(float(my_product_price))
|
||||||
|
|
||||||
|
print(my_product_price)
|
||||||
|
if my_product_price < every_product.get("target_price"):
|
||||||
|
print("Available at your required price")
|
||||||
|
result_file.write(every_product.get(
|
||||||
|
"name") + ' - \t' + ' Available at Target Price ' + ' Current Price - ' + str(my_product_price) + '\n')
|
||||||
|
|
||||||
|
else:
|
||||||
|
print("Still at current price")
|
||||||
|
|
||||||
|
finally :
|
||||||
|
result_file.close()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
33
ML/SnapDealTracker-200910-134042.py
Normal file
33
ML/SnapDealTracker-200910-134042.py
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
import requests
|
||||||
|
from bs4 import BeautifulSoup
|
||||||
|
|
||||||
|
|
||||||
|
URL = "https://www.snapdeal.com/product/indus-valley-disposable-face-mask/638539148385"
|
||||||
|
|
||||||
|
headers = {
|
||||||
|
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36 OPR/70.0.3728.106"
|
||||||
|
}
|
||||||
|
page = requests.get(URL, headers=headers)
|
||||||
|
soup = BeautifulSoup(page.content, 'html.parser')
|
||||||
|
|
||||||
|
print(page)
|
||||||
|
|
||||||
|
price3 = soup.find("span", {"class": "payBlkBig"})
|
||||||
|
print(price3)
|
||||||
|
print(price3.string)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
BIN
ML/SoftwareEngineeringvsML-201106-133711.pdf
Normal file
BIN
ML/SoftwareEngineeringvsML-201106-133711.pdf
Normal file
Binary file not shown.
82
ML/StringsFromBeginning-200808-140221.py
Normal file
82
ML/StringsFromBeginning-200808-140221.py
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
|
||||||
|
# strings are plain text
|
||||||
|
print("MicroDegree")
|
||||||
|
|
||||||
|
# new line in strings
|
||||||
|
print("Micro\nDegree")
|
||||||
|
|
||||||
|
# can also store it as a variable
|
||||||
|
website = "MicroDegree"
|
||||||
|
|
||||||
|
print(website + "is where i learn technology")
|
||||||
|
|
||||||
|
tutorial = "MicroDegree course in Kannada"
|
||||||
|
|
||||||
|
tutorial = "MicroDegree's course in Kannada"
|
||||||
|
|
||||||
|
tutorial = 'MicroDegrees course in "Kannada" '
|
||||||
|
|
||||||
|
tutorial = 'MicroDegrees course multi line ' \
|
||||||
|
' in "Kannada" '
|
||||||
|
|
||||||
|
print(tutorial)
|
||||||
|
|
||||||
|
my_email = ''' Hello sir
|
||||||
|
|
||||||
|
I want to apply for this course
|
||||||
|
Thank you
|
||||||
|
'''
|
||||||
|
|
||||||
|
print(my_email)
|
||||||
|
|
||||||
|
# access by index - python - internally indexes
|
||||||
|
tutorial = "MicroDegree course in Kannada"
|
||||||
|
|
||||||
|
print(tutorial[5])
|
||||||
|
|
||||||
|
# negative index
|
||||||
|
tutorial = "MicroDegree course in Kannada"
|
||||||
|
# -2-1
|
||||||
|
print(tutorial[-4])
|
||||||
|
|
||||||
|
# 0 vs 1
|
||||||
|
|
||||||
|
|
||||||
|
tutorial = "MicroDegree course in Kannada"
|
||||||
|
|
||||||
|
# character vs string
|
||||||
|
print(tutorial[0:3])
|
||||||
|
|
||||||
|
# start index
|
||||||
|
print(tutorial[0:])
|
||||||
|
|
||||||
|
# end index
|
||||||
|
print(tutorial[1:])
|
||||||
|
|
||||||
|
# python interpreter assumes - 0 as the start index
|
||||||
|
print(tutorial[:5])
|
||||||
|
|
||||||
|
# start index is 0 and length as end index
|
||||||
|
print(tutorial[:])
|
||||||
|
|
||||||
|
tutorial_copy = tutorial[:]
|
||||||
|
print(tutorial_copy)
|
||||||
|
|
||||||
|
# Exercise
|
||||||
|
|
||||||
|
state = "Karnataka"
|
||||||
|
print(state[1:-1])
|
||||||
|
|
||||||
|
# special type of string concatenation - formatted string
|
||||||
|
first = 'MicroDegree'
|
||||||
|
|
||||||
|
print(f"Hello There {first} is a tutorial site")
|
||||||
|
|
||||||
|
formattedString = f"Hello There {first} is a tutorial site"
|
||||||
|
print("formayyed string here "+formattedString)
|
||||||
|
|
||||||
|
# dynamically access values in string
|
||||||
|
use_now = f'Hello ${first} how are you'
|
||||||
|
|
||||||
|
|
||||||
|
|
14
ML/TuplesProgram-200808-182244.py
Normal file
14
ML/TuplesProgram-200808-182244.py
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
my_marks = (24, 14, 45, 75, 100)
|
||||||
|
|
||||||
|
#once we add - you cannot change - no insert , remove , edit modify
|
||||||
|
|
||||||
|
# only 2 methods - no remove,clear,pop
|
||||||
|
print(my_marks[2])
|
||||||
|
|
||||||
|
# now try assigning and test
|
||||||
|
my_marks[1] = 100
|
||||||
|
|
||||||
|
gps_loction_my_home = (12.344, 32.123)
|
||||||
|
|
||||||
|
|
BIN
ML/TypesofML-201105-121856.pptx
Normal file
BIN
ML/TypesofML-201105-121856.pptx
Normal file
Binary file not shown.
7
ML/WhileProgram1-200808-185317.py
Normal file
7
ML/WhileProgram1-200808-185317.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
initial=1
|
||||||
|
while initial<=5:
|
||||||
|
print (initial)
|
||||||
|
initial=initial+1
|
||||||
|
|
||||||
|
print("Done")
|
54
ML/WorkingWithNumbers-200808-140445.py
Normal file
54
ML/WorkingWithNumbers-200808-140445.py
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
print(14)
|
||||||
|
print(12.3456)
|
||||||
|
print(-12.3456)
|
||||||
|
|
||||||
|
# also assign to a variable
|
||||||
|
my_account_balance = 2145.23
|
||||||
|
|
||||||
|
print(12 + 16) # addition
|
||||||
|
|
||||||
|
print(25 / 3) # division - return floating point
|
||||||
|
|
||||||
|
print(25 // 3) # division - return integer
|
||||||
|
|
||||||
|
print(15 % 5) # remainder of division - modulus operator - 15 mod 3
|
||||||
|
|
||||||
|
print(2 ** 3) # 2 to the power 3
|
||||||
|
|
||||||
|
|
||||||
|
# Operator precedence - order of operation
|
||||||
|
|
||||||
|
total = 12 + 25 * 2
|
||||||
|
print(total)
|
||||||
|
|
||||||
|
# order -> exponential - multiplication or divi - add or subtract
|
||||||
|
# parenthesis has higher
|
||||||
|
value = (12 - 2) * (25 + 4)
|
||||||
|
|
||||||
|
print(value)
|
||||||
|
|
||||||
|
# convert to strings
|
||||||
|
print(str(value)) # - helps in printing numbers with string
|
||||||
|
|
||||||
|
# try increment a number -
|
||||||
|
x = 1
|
||||||
|
x += 4
|
||||||
|
|
||||||
|
# Functions in Maths - mathemeatical operations
|
||||||
|
my_account_balance = 2145.23
|
||||||
|
|
||||||
|
print(round(my_account_balance)) # rounding off decimal
|
||||||
|
|
||||||
|
my_account_balance = -2145.23
|
||||||
|
print(abs(my_account_balance)) # removes negative - absolute value
|
||||||
|
|
||||||
|
print(pow(5, 2)) # 5 to the power of 2
|
||||||
|
print(max(123, 324)) # max of 2 nums
|
||||||
|
|
||||||
|
# Math functions by importing
|
||||||
|
import math
|
||||||
|
|
||||||
|
print(math.ceil(my_account_balance)) # round the num
|
||||||
|
print(math.floor(my_account_balance)) # chop off the decimal point
|
||||||
|
print(math.sqrt(9)) # square root of 9
|
||||||
|
|
7
ML/ifElseProgram-200808-182547.py
Normal file
7
ML/ifElseProgram-200808-182547.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
is_pass=True
|
||||||
|
|
||||||
|
if is_pass:
|
||||||
|
print("Congrats you are passed")
|
||||||
|
|
||||||
|
else:
|
||||||
|
print("Sorry you have failed")
|
1
ML/microdegreemlpythonrecap1-201106-130921.ipynb
Normal file
1
ML/microdegreemlpythonrecap1-201106-130921.ipynb
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"cells":[{"metadata":{},"cell_type":"markdown","source":"## Python fundamentals:\n1. Condition checking\n2. Arrays/Lists\n3. Looping\n4. File I/O"},{"metadata":{},"cell_type":"markdown","source":"### Condition checking"},{"metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"cell_type":"code","source":"a = 55\nb = 55\nif a>b:\n print(str(a) + \" > \" + str(b))\nelif a == b:\n print(str(a) + \" == \" + str(b))\nelse:\n print(str(a) + \" < \" + str(b))","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"### Array"},{"metadata":{"trusted":true},"cell_type":"code","source":"arr = [2, 4, 6, 8]\narr.append(11)\nfor el in arr:\n print(el)","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"### Looping"},{"metadata":{"trusted":true},"cell_type":"code","source":"idx = 0\nwhile(idx < len(arr)):\n print(arr[idx])\n idx = idx + 1","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"### File I/O"},{"metadata":{"trusted":true,"collapsed":true},"cell_type":"code","source":"fd = open(\"/kaggle/input/tips-data/tips.csv\", 'r')\nprint(fd.read())\nfd.close()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"fd_o = open(\"/kaggle/working/sample.csv\", \"w+\")\nfd_o.write(\"Col1,Col2\\n2,4\")\nfd_o.close()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"fd1 = open(\"/kaggle/working/sample.csv\", 'r')\nprint(fd1.read())\nfd1.close()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"## Installing 3rd party libraries which are not yet installed."},{"metadata":{"trusted":true},"cell_type":"code","source":"#Step-1\nimport pandas as PyPDF2\n","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"#Step-2\n!pip install PyPDF2","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"#Step-3:\nimport pandas as PyPDF2","execution_count":null,"outputs":[]}],"metadata":{"kernelspec":{"name":"python3","display_name":"Python 3","language":"python"},"language_info":{"name":"python","version":"3.7.6","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat":4,"nbformat_minor":4}
|
51
ML/my_sample_data-201106-111147.csv
Normal file
51
ML/my_sample_data-201106-111147.csv
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
Bill,Tips
|
||||||
|
16,0
|
||||||
|
23,0
|
||||||
|
13,0
|
||||||
|
90,5
|
||||||
|
56,0
|
||||||
|
27,0
|
||||||
|
94,6
|
||||||
|
52,0
|
||||||
|
7,0
|
||||||
|
22,0
|
||||||
|
90,10
|
||||||
|
15,0
|
||||||
|
27,0
|
||||||
|
93,7
|
||||||
|
27,0
|
||||||
|
17,0
|
||||||
|
120,10
|
||||||
|
7,0
|
||||||
|
165,5
|
||||||
|
67,3
|
||||||
|
19,0
|
||||||
|
12,0
|
||||||
|
78,2
|
||||||
|
19,0
|
||||||
|
83,5
|
||||||
|
45,0
|
||||||
|
41,0
|
||||||
|
86,4
|
||||||
|
37,0
|
||||||
|
8,0
|
||||||
|
112,8
|
||||||
|
22,0
|
||||||
|
53,2
|
||||||
|
0,0
|
||||||
|
100,5
|
||||||
|
8,0
|
||||||
|
16,0
|
||||||
|
35,0
|
||||||
|
150,10
|
||||||
|
25,0
|
||||||
|
48,0
|
||||||
|
17,0
|
||||||
|
135,5
|
||||||
|
10,0
|
||||||
|
55,5
|
||||||
|
36,4
|
||||||
|
17,0
|
||||||
|
10,0
|
||||||
|
29,0
|
||||||
|
11,0
|
|
4
ML/sample-201106-111152.csv
Normal file
4
ML/sample-201106-111152.csv
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
Column1,Column2
|
||||||
|
Chandan,chandan@some.com
|
||||||
|
Darshan,darshan@some.com
|
||||||
|
User1, user1@some.com
|
|
BIN
ML/~$NLP.docx
Normal file
BIN
ML/~$NLP.docx
Normal file
Binary file not shown.
BIN
ML/~WRL2566.tmp
Normal file
BIN
ML/~WRL2566.tmp
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user