Skip to main content

Featured

VIDEO DOWNLOADER USING PYTHON

 SO IN THIS BLOG I WILL SHOW THE VIDEO DOWNLOADER.SO YOU HAVE TO ENTER THE LINK OF THE VIDEO AND PASTE IT IN THE PROGRAM AND IT WILL BE DOWNLOADED IN THE FOLDER YOU HAVE SAVED IT.SO YOU CAN MAKE A FOLDER FOR THIS PROGRAM. REQIREMENTS :- pip install pytube SOURCE CODE-: from pytube import YouTube  url = input("enter the url of video: ") my_video = YouTube(url) print("***********video title***********") print(my_video.title) print("***********thumbnail image***********") print(my_video.thumbnail_url)      print("downloading video") my_video = my_video.streams.get_highest_resolution() my_video.download() print("video downloaded") SO THIS IS THE SOURCE CODE. THANK YOU.

snake game in python

HELLO EVERYONE NEW POST OF OUR PYTHON FILE :-

how to install module :- on keybourd use the key windows+r and then box will appear and in that enter cmd and press enter and it will open cmd and then pip install freegames

module to be installed :- pip install freegames

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):
    aim.x = x
    aim.y = y

def inside(head):
  return -200 < head.x < 190 and -200 < head.y < 190

def move():
    head = snake[-1].copy()
    head.move(aim)

    if not inside(head) or head in snake:
        square(head.x, head.y, 9, 'green')
        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, 'black')

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

setup(420, 420, 370, 0)    
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()

so please tell me in the comment whether it works or not

Comments

Post a Comment

Popular Posts