mardi 11 août 2020

what is the named and optional arguments in python

I want to randomize a list of strings, I used random.shuffle and I don't know what is the (optional float , and the named float) here is my code (the only error in it is (Expected type 'Optional[() -> float]', got 'float' instead))

   import random
def randomizefuture ():
    randomfuture = random.sample(allfutures, 3)
    print(randomfuture)

print("Hi")
user_input = str(input(" write T to see your future \n"))
allfutures = ["jk", "sigh!", "you will die !"]
if user_input == "T":
    if True:
        randomfuture = random.shuffle(allfutures,3.0)
        print(randomfuture)



Aucun commentaire:

Enregistrer un commentaire