Search code examples
pythonaudiolooper

I want to take input for while loop by user and i want download the end result


Actually I was writing a program in python to create a audio lopper I want to take input from user for no of times to loop and and i want to download the file can any one help me

count = 0
while count < 108:
import playsound
import time
playsound.playsound("C:\\Users\\admin\\Desktop\\SAMPLE\\m1.mp3" )
time.sleep(10)
count = count+1

Solution

  • You can just use the input() function to take input from the user and then int() to typecast it into an integer(default input type is a string).

    import playsound
    import time
    
    user_input = int(input('enter number: '))
    count = 0
    while count < user_input:
        playsound.playsound("C:\\Users\\admin\\Desktop\\SAMPLE\\m1.mp3" )
        time.sleep(10)
        count = count+1