G
G
Grishan Trudovik2019-08-18 15:11:23
Python
Grishan Trudovik, 2019-08-18 15:11:23

There is a python code that should play sounds. How and where to run it to make it work?

I’m just getting acquainted with Python
, I don’t understand how to run the code so that the PC starts making sounds
, the code seems to be without errors

import winsound
from random import randint
from time import sleep
MAX_FREQUENCY = 2500
MAX_DURATION = 1000
def generate_random_beeps(minutes):
    for _ in range(minutes * 1000):
        frequency = randint(1, MAX_FREQUENCY)
        duration = randint(1, MAX_FREQUENCY)
        winsound.Beep(frequency, duration)
        sleep(10)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question