mercredi 6 janvier 2016

why won't my if else statment work properly [duplicate]

This question already has an answer here:

when i run with 0,1 for the input when asked

    numberOfPhotos = input("How long of a timelaps do you want the timelaps? hours,minutes or 0,0 for no limit: ")
    numberOfPhotos = numberOfPhotos.split(',' ,1)
    print(numberOfPhotos)
    print(int(numberOfPhotos[0]))
    print(int(numberOfPhotos[1]))
    if int(numberOfPhotos[0]) == 0 & int(numberOfPhotos[1]) == 0:
        print("photos will run forever until stopped")
        start = input("whould you like to start the timelapse now? y,n: ")
        if start.lower() == "y":
            var = 4
        elif start.lower() == "n":
            startCamera()

    else:
        numberOfPhotos = int(numberOfPhotos[0]) * 60 * 60 + int(numberOfPhotos[1]) * 60 / sleepTime
        print(numberOfPhotos + 2)
        start = input("whould you like to start the timelapse? y,n: ")
        if start.lower() == "y":
            var = 3
        elif start.lower() == "n":
            startCamera()

it returns

How long of a timelaps do you want the timelaps? hours,minutes or 0,0 for no limit: 0,1
['0', '1']
0
1
photos will run forever until stopped

also i tried changing the else statement to elif int(numberOfPhotos[0]) != 0 & int(numberOfPhotos[1]) != 0: why is it doing this and how can i fix this, and i somewhat need this by 3:30 az time.

Aucun commentaire:

Enregistrer un commentaire