AK Python
1.86K subscribers
39 photos
2 videos
11 files
236 links
Join here to unlock your programming ability
Download Telegram
Code for Fidget spinner ❤️[ Share & support ]
from turtle import *
from random import randrange
from freegames import square, vector

food = vector(0, 0)
snake = [vector(10, 0)]
aim = vector(0, -10)

def change(x, y):
"Change snake direction."
aim.x = x
aim.y = y

def inside(head):
"Return True if head inside boundaries."
return -200 < head.x < 190 and -200 < head.y < 190

def move():
"Move snake forward one segment."
head = snake[-1].copy()
head.move(aim)

if not inside(head) or head in snake:
square(head.x, head.y, 9, 'red')
update()
return

snake.append(head)

if head == food:
print('Snake:', len(snake))
food.x = randrange(-15, 15) * 10
food.y = randrange(-15, 15) * 10
else:
snake.pop(0)

clear()

for body in snake:
square(body.x, body.y, 9, 'green')

square(food.x, food.y, 9, 'red')
update()
ontimer(move, 100)


hideturtle()
tracer(False)
listen()
onkey(lambda: change(10, 0), 'Right')
onkey(lambda: change(-10, 0), 'Left')
onkey(lambda: change(0, 10), 'Up')
onkey(lambda: change(0, -10), 'Down')
move()
done()
👍7👏1
Code for snake game [ Share our channel ❤️ ]
Check out our new video
import psutil

battery = psutil.sensors_battery()
percent = battery.percent
from pynotifier import Notification

Notification(
title="Battery Percentage.",
description=str(percent) + "% Battery remaining.",
duration=5, # Duration in seconds
).send()
👍2
Code for battery notifier sorry for the delay 👍
👍1
import COVID19Py

covid19 = COVID19Py.COVID19(data_source="jhu")
latest = covid19.getLatest()

from pynotifier import Notification

Notification(
title="Today COVID 19 News updates.",
description=str(latest),
duration=30, # Duration in seconds
).send()
Code for covid 19 Notifier using python 👍
👍1
[ share and support ]
This media is not supported in your browser
VIEW IN TELEGRAM
Keep support and share. I will try my best❤️
import moviepy.editor as mp
clip=mp.VideoFileClip(r'Path of your video file')
clip.audio.write_audiofile(r'Path of your audio file')
👍1
Code for conversion of mp4 to mp3 [ keep support and share ❤️ ]
New video is out now
I planned to start a new series in Python.

Answer the poll..!
Anonymous Poll
68%
Ethical Hacking series
32%
Data science series