vendredi 4 décembre 2020

My code seems to prioritize the top value, anybody got a fix?

import random
import time
val = True
cache = "a"
itemlist = ["Rusty Spoon", "Few warcrime charges for Bill Clinton", "Sweets", "Chocolate", "Party hat"]
jokelist = ["Q:Why cant snowmen have babies? \nA:They got Sno' Balls!", "Q: What did the snowman get from the vampire?\n A: Frostbite!", "Q: Why doesn't Santa have kids of his own?\n A: Because he only cums once a year and when he does, it's through the chimney!", "Q: What do you call a scary raindeer?\n A: Cariboo!", "Q: Why don’t people like Apple Mac’s new Christmas calendars?\nA: They don’t have any windows."]
Ip = input("Do you want a joke? Or an item? Or type stop to halt.")
while Ip == "item" or "Item":
    if Ip == "item" or "Item" not "joke" or "Joke" or "Stop" or "stop": 
        ri = random.choice(itemlist)
        print ("Wow you got a ",ri , ". Consider yourself lucky!")
        Ip = input("Do you want a joke? Or an item? Or type stop to halt.")
    else:
        break
while Ip == "joke" or  "Joke":
        jk = random.choice(jokelist)
        print (jk)
        Ip = input("Do you want a joke? or an item? Or type stop to halt.")
while Ip != "stop" or "Stop":
        print ("invalid try again")
        Ip = input("Do you want a joke? Or an item? Or type stop to halt.")
while Ip == "Stop" or "stop":
        print ("Shutting Down")
        break

Pretty much, it just prioritises item because it's at the top but I can't find a workaround, any help is much appreciated :)

Aucun commentaire:

Enregistrer un commentaire