#CODE
Enter your IP address : 40.124.46.157 40[.]124[.]46[.]157
Python Coding August 13, 2022 Python No comments
Enter your IP address : 40.124.46.157 40[.]124[.]46[.]157
Python Coding May 03, 2022 Python No comments
Python Coding May 03, 2022 Python No comments
#!/usr/bin/env python
# coding: utf-8
# # Pie Charts using Matplotlib in Python
# In[2]:
#Pie Charts using Matplotlib in Python
import matplotlib.pyplot as pyplot
labels = ('Python', 'Java', 'Scala', 'C#')
sizes = [45, 30, 15, 10]
pyplot.pie(sizes,
labels=labels,
autopct='%1.f%%',
counterclock=False,
startangle=105)
# Display the figure
pyplot.show()
#clcoding.com
# In[ ]:
# In[ ]:
Python Coding May 03, 2022 Python No comments
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
pip install forex_python
# # Real-time Currency Converter with Python
# In[7]:
from forex_python.converter import CurrencyRates
c = CurrencyRates()
amount = int(input("Enter the amount: "))
from_currency = input("From Currency: ").upper()
to_currency = input("To Currency: ").upper()
print(from_currency, " To ", to_currency, amount)
result = c.convert(from_currency, to_currency, amount)
print(result)
#clcoding.com
# In[ ]:
Python Coding May 03, 2022 Python No comments
Python Coding May 03, 2022 Python No comments
Python Coding May 03, 2022 Python No comments
Python Coding May 03, 2022 Python No comments
#!/usr/bin/env python
# coding: utf-8
# # Pick a Random Card using Python
# In[8]:
import random
cards = ["Diamonds", "Spades", "Hearts", "Clubs"]
ranks = [2, 3, 4, 5, 6, 7, 8, 9, 10,
"Jack", "Queen", "King", "Ace"]
def pick_a_card():
card = random.choices(cards)
rank = random.choices(ranks)
return(f"The {rank} of {card}")
print(pick_a_card())
#clcoding.com
# In[ ]:
Python Coding May 03, 2022 Python No comments
#!/usr/bin/env python
# coding: utf-8
# # Fidget Spinner game with Python
# In[7]:
from turtle import *
state = {'turn': 0}
def spinner():
clear()
angle = state['turn']/10
right(angle)
forward(100)
dot(120, 'cyan')
back(100)
right(120)
forward(100)
dot(120, 'green')
back(100)
right(120)
forward(100)
dot(120, 'blue')
back(100)
right(120)
update()
def animate():
if state['turn']>0:
state['turn']-=1
spinner() #clcoding.com
ontimer(animate, 20)
def flick():
state['turn']+=10
setup(420, 420, 370, 0)
hideturtle()
tracer(False)
width(20)
onkey(flick, 'space')
listen()
animate()
done()
# In[ ]:
# In[ ]:
Python Coding May 03, 2022 Python No comments
Python Coding May 03, 2022 Python No comments
#!/usr/bin/env python
# coding: utf-8
# # Chessboard using Matplotlib in Python
# In[17]:
import matplotlib.pyplot as plt
dx, dy = 0.015, 0.015
x = np.arange(-4.0, 4.0, dx)
y = np.arange(-4.0, 4.0, dy)
X, Y = np.meshgrid(x, y)
extent = np.min(x), np.max(x), np.min(y), np.max(y)
z1 = np.add.outer(range(8), range(8)) % 2
plt.imshow(z1, cmap="binary_r", interpolation="nearest", extent=extent, alpha=1)
def chess(x, y):
return (1 - x / 2 + x ** 5 + y ** 6) * np.exp(-(x ** 2 + y ** 2))
z2 = chess(X, Y)
plt.imshow(z2, alpha=0, interpolation="bilinear", extent=extent)
plt.title("Chess Board in Python")
plt.show()
#clcoding.com
# In[ ]:
Python Coding May 03, 2022 Python No comments
Python Coding April 16, 2022 Python No comments
#!/usr/bin/env python
# coding: utf-8
# # Live Weather Updates with Python
# In[7]:
from bs4 import BeautifulSoup
import requests
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3'}
def weather(city):
city=city.replace(" ","+")
res = requests.get(f'https://www.google.com/search?q={city} &oq={city}&aqs=chrome.0.35i39l2j0l4j46j69i60.6128j1j7&sourceid= chrome&ie=UTF-8',headers=headers)
print("Searching......\n")
soup = BeautifulSoup(res.text,'html.parser')
location = soup.select('#wob_loc')[0].getText().strip()
time = soup.select('#wob_dts')[0].getText().strip()
info = soup.select('#wob_dc')[0].getText().strip()
weather = soup.select('#wob_tm')[0].getText().strip()
print(location)
print(time)
print(info)
print(weather+"°C")
city=input("Enter the Name of Any City >> ")
city=city+" weather"
weather(city)
#clcoding.com
# In[ ]:
Python Coding April 16, 2022 Python No comments
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
pip install seaborn
# # Violin Plot using Python
# In[9]:
import seaborn as sns
import matplotlib.pyplot as plt
data = sns.load_dataset("tips")
plt.figure(figsize=(10, 4))
sns.violinplot(x=data["total_bill"])
plt.show()
#clcoding.com
# In[6]:
# In[ ]:
Python Coding April 16, 2022 Python No comments
#!/usr/bin/env python
# coding: utf-8
# # Text wrapping in Python
# In[17]:
import textwrap
value = """This function wraps the input paragraph such that each line
in the paragraph is at most width characters long. The wrap method
returns a list of output lines. The returned list
is empty if the wrapped
output has no content."""
# Wrap this text.
wrapper = textwrap.TextWrapper(width=70)
word_list = wrapper.wrap(text=value)
# Print each line.
for element in word_list:
print(element)
#clcoding.com
# In[ ]:
Python Coding April 16, 2022 Python No comments
Python Coding April 09, 2022 Python No comments
Python Coding April 09, 2022 Python No comments
Python Coding April 09, 2022 Python No comments
#!/usr/bin/env python
# coding: utf-8
# # BMI Calculator with Python
# In[7]:
Height=float(input("Enter your height in centimeters: "))
Weight=float(input("Enter your Weight in Kg: "))
Height = Height/100
BMI=Weight/(Height*Height)
print("your Body Mass Index is: ",BMI)
if(BMI>0):
if(BMI<=16):
print("you are severely underweight")
elif(BMI<=18.5):
print("you are underweight")
elif(BMI<=25):
print("you are Healthy")
elif(BMI<=30):
print("you are overweight")
else: print("you are severely overweight")
else:("enter valid details")
#clcoding.com
# In[ ]:
Python Coding April 09, 2022 Python No comments
Python Coding April 09, 2022 Python No comments
Python Coding April 03, 2022 Python No comments
Python Coding April 03, 2022 Python No comments
#!/usr/bin/env python
# coding: utf-8
# # Roman Numbers to Decimals in Python
# In[6]:
tallies = {'I': 1,'V': 5,'X': 10,'L': 50,
'C': 100,'D': 500,'M': 1000}
def RomanNumeralToDecimal(romanNumeral):
sum = 0
for i in range(len(romanNumeral) - 1):
left = romanNumeral[i]
right = romanNumeral[i + 1]
if tallies[left] < tallies[right]:
sum -= tallies[left]
else:
sum += tallies[left]
sum += tallies[romanNumeral[-1]]
return sum
roman=input("Enter Roman Numbers :")
RomanNumeralToDecimal(roman)
#clcoding.com
# In[ ]:
Python Coding April 03, 2022 Python No comments
Python Coding April 03, 2022 Python No comments
Python Coding April 03, 2022 Python No comments
#!/usr/bin/env python
# coding: utf-8
# # Count Character Occurrences using Python
# In[5]:
def count_characters(s):
count = {}
for i in s:
if i in count:
count[i] += 1
else:
count[i] = 1
print(count)
word=input("Enter your string:")
count_characters(word)
#clcoding.com
Python Coding April 03, 2022 Python No comments
Python Coding March 25, 2022 Python No comments
#!/usr/bin/env python
# coding: utf-8
# # Sequence Matcher in Python
# In[3]:
from difflib import SequenceMatcher
text1 = input("Enter 1st sentence : ")
text2 = input("Enter 2nd sentence : ")
sequenceScore = SequenceMatcher(None, text1, text2).ratio()
print(f"Both are {sequenceScore * 100} % similar")
#clcoding.com
# In[ ]:
Python Coding March 25, 2022 Python No comments
Python Coding March 19, 2022 Python No comments
Python Coding March 13, 2022 Python No comments
Python Coding March 13, 2022 Python No comments
Python Coding March 13, 2022 Python No comments
Python Coding March 13, 2022 Python No comments
Python Coding March 05, 2022 Python No comments
Python Coding March 04, 2022 Python No comments
Python Coding February 28, 2022 Python No comments
Python Coding February 26, 2022 Python No comments
Python Coding February 26, 2022 Python No comments
Python Coding February 17, 2022 Python No comments
Python Coding February 05, 2022 Python No comments
Python Coding February 05, 2022 Python No comments
Python Coding February 05, 2022 Python No comments
Free Books Python Programming for Beginnershttps://t.co/uzyTwE2B9O
— Python Coding (@clcoding) September 11, 2023
Top 10 Python Data Science book
— Python Coding (@clcoding) July 9, 2023
🧵:
Top 4 free Mathematics course for Data Science ! pic.twitter.com/s5qYPLm2lY
— Python Coding (@clcoding) April 26, 2024
Web Development using Python
— Python Coding (@clcoding) December 2, 2023
🧵: