jeudi 3 mai 2018

Python 3 Single dimensional Arrays

x={}
continueQ=input("would you like to continue?")
if (continueQ=="yes"):
    #if there is less than 4

    if x<4:        

        variable=float(input("Input a float to append to the array:") 
        x.append(variable)
        print(x)


    else:           
        print(x)
else:
    print("Goodbye!")

There are a few errors in this code, could someone help me how to create an if statement to check if there are less than 4 values inside an array. Also how to append to an array from an input.

Aucun commentaire:

Enregistrer un commentaire