Feb-08-2019, 02:49 AM
Okay, so recently I've been trying to make a program that makes very simple sentences. I've made a breakthrough by figuring out that 'if' and 'or' exist. Right now it looks like this:
I love people
I killed god
but sometimes it'll do just the ones from love/hate, which means that it only happens when random.choice(an) = 'killed'. How do I fix this so that only one or the other gets shown? I plan on adding another line for another random.choice(an) and I need to fix the problem so it doesn't keep outputting more than I want it to. Thanks in advance!
if random.choice(ss) is 'I': if random.choice(an) is 'hate' or 'love': print("I " + random.choice(hl) + " " + random.choice(Pn))That's all fine, but then I added another line in, so now it looks like this:
if random.choice(ss) is 'I': if random.choice(an) is 'hate' or 'love': print("I " + random.choice(hl) + " " + random.choice(Pn)) if random.choice(an) is 'killed': print("I killed " + random.choice(ka))Now, it sometimes prints both things, so it'll be like
I love people
I killed god
but sometimes it'll do just the ones from love/hate, which means that it only happens when random.choice(an) = 'killed'. How do I fix this so that only one or the other gets shown? I plan on adding another line for another random.choice(an) and I need to fix the problem so it doesn't keep outputting more than I want it to. Thanks in advance!