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.

HANGMAN IN PYHTON

 HELLO EVERYONE THIS IS MY NEW POST OF A GAME CALLED HANGMAN  AND THIS IS HANGMAN USING PYTHON

SOURCE CODE OF HANGMAN :-


import random


HANGMANPICS = ['''


  +-----+

  |     |

        |

        |

        |

        |

==========''','''


  +-----+

  |     |

  0     |

        |

        |

        |

==========''','''


  +-----+

  |     |

  0     |

  |     |

        |

        |

==========''','''


  +-----+

  |     |

  0     |

 /|     |

        |

        |

==========''','''


  +-----+

  |     |

  0     |

 /|\    |

        |

        |

==========''','''


  +-----+

  |     |

  0     |

 /|\    |

 /      |

        |

==========''','''


  +-----+

  |     |

  0     |

 /|\    |

 / \    |

        |

==========''']


words = 'baboon beaver invent python turtle pigeon monkey donkey rabbit lizard jarvis laptop pillow hangman shirt avenger people'.split()


def getRandomWord(wordList):

    wordIndex = random.randint(0, len(wordList) - 1)

    return wordList[wordIndex]


def displayBoard(HANGMANPICS, missedLetters, correctLetters, secretWord):

    print(HANGMANPICS[len(missedLetters)])

    print()


    print('Missed letter:', end=' ')

    for letter in missedLetters:

        print(letter, end=' ')

    print()


    blanks = '_' * len(secretWord)


    for i in range(len(secretWord)):

        if secretWord[i] in correctLetters:

            blanks = blanks [:i] + secretWord [i] + blanks [i+1:]


    

    for letter in blanks:

        print(letter, end=' ')

    print()


def getGuess(alreadyGuessed):

    while True:

        print('Guess a letter.')

        guess = input()

        guess = guess.lower()

        if len(guess) != 1:

            print("Please enter a letter.")

        elif guess in alreadyGuessed :

            print('You have already guessed that letter. Choose again.')

        elif guess not in 'abcdefghijklmnopqrstuvwxyz':

            print('Please enter a LETTER.')

        else:

            return guess


def playAgain():

    print('Do you want to play again (Yes or No)')

    return input().lower().startswith('y')


print('H A N G M A N')

missedLetters = ''

correctLetters = ''

secretWord = getRandomWord(words)

gameIsDone = False


while True:

    displayBoard(HANGMANPICS, missedLetters, correctLetters, secretWord)


    guess = getGuess(missedLetters + correctLetters)


    if guess in secretWord:

        correctLetters = correctLetters + guess


        foundAllLetters = True

        for i in range(len(secretWord)):

            if secretWord[i] not in correctLetters:

                foundAllLetters = False

                break

        if foundAllLetters:

            print('Yes! The secret word is "' + secretWord + '"! You have won!')

            gameIsDone

    else:

        missedLetters = missedLetters + guess


        if len(missedLetters) == len(HANGMANPICS) - 1:

            displayBoard(HANGMANPICS, missedLetters, correctLetters,secretWord)

            print('You have ran out of guesses!\nafter' + str(len(missedLetters)) + 'missed guesses and' + str(len(correctLetters)) + 'correct guesses, the word"' + secretWord + '"') 

            gameIsDone


    if gameIsDone:

        if playAgain():

            missedLetters = ''

            correctLetters = ''

            gameIsDone = False

            secretWord = getRandomWord(words)

        else:

            break 

            

  PLEASE TRY IT AND  TELL ME IT WORKS OR NOT AND FOLLOW ME 

Comments

Post a Comment

Popular Posts