Cozy Corners India
203 subscribers
7 photos
10 files
41 links
Home decor and Clothing Product at cheaper rate
Download Telegram
Cozy Corners India
Photo
# import object from module turtle

from turtle import *

  

# initial state of spinner is null (stable)

state= {'turn':0 }

  

# Draw fidget spinner

def spin():

    clear()

  

    # Angle of fidget spinner

    angle = state['turn']/10

  

    # To rotate in clock wise we use right

    # for Anticlockwise rotation we use left

    right(angle)

  

    # move the turtle forward by specified distance

    forward(100)

  

    # draw a dot with diameter 120 using colour red

    dot(120, 'red')

  

    # move the turtle backward by specified distance

    back(100)

  

    "second dot"

    right(120)

    forward(100)

    dot(120, 'blue')

    back(100)

  

    "third dot"

    right(120)

    forward(100)

    dot(120, 'green')

    back(100)

    right(120)

  

    update()

  

# Animate fidget spinner

def animate():

    if state['turn']>0:

        state['turn']-=1

      

    spin()

    ontimer(animate, 20)

      

# Flick fidget spinner

def flick():

    state['turn']+=40 #acceleration of spinner

  

# setup window screen

setup(600, 400, 370, 0)

bgcolor("black")

  

tracer(False)

  

# wing of fidget spinner

width(60)

color("orange")

  

# keyboard key for the rotation of spinner

onkey(flick,'space')

  

listen()

animate()

done()
Cozy Corners India
https://youtube.com/shorts/mHasTBVZklo?feature=share
Python script to shows Laptop Battery Percentage
psutil is a cross-platform library for retrieving information on running processes and system utilization(CPU, memory, disks, networks, sensors) in Python. The Python script below can be run in both Windows and Linux. Install psutil in windows by :

pip install psutil
Install psutil in Linux by:

sudo apt-get install gcc python3-dev
sudo pip3 install psutil
Code:

# python script showing battery details

import psutil


# function returning time in hh:mm:ss

def convertTime(seconds):

minutes, seconds = divmod(seconds, 60)

hours, minutes = divmod(minutes, 60)

return "%d:%02d:%02d" % (hours, minutes, seconds)


# returns a tuple

battery = psutil.sensors_battery()



print("Battery percentage : ", battery.percent)

print("Power plugged in : ", battery.power_plugged)


# converting seconds to hh:mm:ss

print("Battery left : ", convertTime(battery.secsleft))
Output:

Battery percentage : 57
Power plugged in : False
Battery left : 1:58:32
Explanation:

psutil.sensors.battery() returns a named tuple consisting of following values. If no battery is installed or metrics can’t be determined None is returned.

percent: Power left in percentage.
secsleft: Approx seconds left before the power runs out. It is set to psutil.POWER_TIME_UNLIMITED if it is on charging. If this value can’t be determined it is set to psutil.POWER_TIME_UNKNOWN .
power_plugged: True if power is plugged in, False if it isn’t charging or None if it can’t be determined.
Cozy Corners India
Photo
import turtle
import colorsys

t = turtle.Turtle()
s = turtle.Screen()
s.bgcolor("black")
t.speed(0)
n=36
h=0

for i in range(460):
c=colorsys.hsv_to_rgb(h,1,0.9)
h+=1/n
t.color(c)
t.left(145)
for j in range(5):
t.forward(300)
t.left(150)
Cozy Corners India
Photo
from turtle import *

def move_to( x, y ):
penup()
setx( x )
sety( y )
pendown()

def draw_triangle( size ):
color( 'black', 'green')
begin_fill()
setheading( 240 )
for i in range( 0,3 ):
forward( size )
left( 120 )
end_fill()

def draw_circle( size, c_color ):
color( 'black', c_color )
begin_fill()
circle( size )
end_fill()

def draw_star( size ):
color( 'black', 'yellow' )
setheading( 72 )
begin_fill()

for i in range( 0, 5 ):
forward( size )
right( 144 )
end_fill()

# Draw the tree
move_to( 50, -80 )
draw_triangle( 200 )

move_to( 50, 0 )
draw_triangle( 150 )

move_to( 50, 50 )
draw_triangle( 100 )

# Draw the star

move_to( 39, 40 )
draw_star( 40 )

# Draw the ornaments

move_to( 80, -40 )
draw_circle( 15, 'red' )

move_to( 20, -100 )
draw_circle( 15, 'blue' )

move_to( 100, -200 )
draw_circle( 15, 'purple' )


# Draw the message
move_to( -30, 100 )
write( "Merry Christmas!", font=( "Arial", 16, "bold" ) )
done()
Top 8 Github Repos to Learn Data Science and Python

1. All algorithms implemented in Python
By: The Algorithms
Stars ⭐️: 135K
Fork: 35.3K
Repo: https://github.com/TheAlgorithms/Python

2. DataScienceResources
By: jJonathan Bower
Stars ⭐️: 3K
Fork: 1.3K
Repo: https://github.com/jonathan-bower/DataScienceResources

3. Playground and Cheatsheet for Learning Python
By: Oleksii Trekhleb ( Also the Image)
Stars ⭐️: 12.5K
Fork: 2K
Repo: https://github.com/trekhleb/learn-python


4. Learn Python 3
By: Jerry Pussinen
Stars ⭐️: 4,8K
Fork: 1,4K
Repo: https://github.com/jerry-git/learn-python3


5. Awesome Data Science
By: Fatih Aktürk, Hüseyin Mert & Osman Ungur, Recep Erol.
Stars ⭐️: 18.4K
Fork: 5K
Repo: https://github.com/academic/awesome-datascience

6. data-scientist-roadmap
By: MrMimic
Stars ⭐️: 5K
Fork: 1.5K
Repo: https://github.com/MrMimic/data-scientist-roadmap


7. Data Science Best Resources
By: Tirthajyoti Sarkar
Stars ⭐️: 1.8K
Fork: 717
Repo: https://github.com/tirthajyoti/Data-science-best-resources/blob/master/README.md


8. Ds-cheatsheets
By: Favio André Vázquez
Stars ⭐️: 10.4K
Fork: 3.1K
Repo: https://github.com/FavioVazquez/ds-cheatsheets
Channel name was changed to «PYTHON PROGRAMMING ❤️»
Channel name was changed to «YouTube: GEEKY FELLA ❤️»
Channel name was changed to «Cozy Corners India»
Channel photo updated
Channel photo updated
Follow the Cozy Corners – Watches & More channel on WhatsApp: https://whatsapp.com/channel/0029Vb5j58RIN9imK6GyNv25