magic 8-ball

Off topicProgramming → magic 8-ball

I decided to make a magic 8-Ball in python and it seems to work pretty good here’s the code:
Great! It took me some time to copy the code… But great! 2 saad
Coded well, now make it more advanced.
import random
import time
print("---------------------------------")
print("Welcome to Magic-8 Ball Simulator")
print("---------------------------------")
# "Concentrate and ask again"
answers = ["Yes, Most definently", "Yes", "99%", "0.01", "No", "Don't count on it"] # 6

def eightball():
	print("-----------------------------")
	print("Ask the 8-Ball a... qeustion?")
	inp = input("Ask your qeustion: ")
	print("Thinking...")
	val = 0
	for x in inp:
		val += ord(x.lower())
	time.sleep(1)
	if random.randint(0,6)==0:
		print("Concentrate and ask again")
	else:
		print(answers[val%6])
	print("-----------------------------")
	restart()
def restart():
	again = input("Ask the 8-Ball another qeustion? Yes/No: ")
	alower = again.lower()
	if alower == "y" or alower == "yes":
		eightball()
	elif alower == "n" or alower == "no":
		print("Bye!")
		quit()

eightball()

Can you find, what I changed?

And what does that mean? :D
it does mostly what my code does random.randint mostly like random.choice not so sure what val += ord(x) means
If you type in: “Can i eat?”, then type in the same, then it will give out the same result.
@bela333 Ah, ok.
@FullyStealth what do you mean by “More advanced”
Ord is the way to get the ASCII character number I think.
@bela333 what editor do you use?
I use Sublime Text
Use IDLE, much better.
@FullyStealth where do you download it from?
It comes with my python, both my 2.8 version and 3.4.2
@FullyStealth Thanks came with my 2.7 and 3.5 I just typed up “IDLE” in search
Haha IDLE better? thats funny lol. That actually nearly made me fall on my arse
There’s a problem in the code. You put print(answers[val%6]). Shouldn’t this be print(answers[val%6-1])?
TBH, that’s what I did the first time too! But if you do val%6, then the smallest number will be 0, and the largest is 5. So, no problem!
@Pan I use sublime text as well, its just that I consider IDLE better because it boots up faster and very little setup is needed.
Don’t remember needing setup for sublime, and seriusly it boots up faster? thats the shittiest reason ive ever heared.

@PanFritz I use an editor called “iep”. its very simple to use.

Seems very crowded imo

Pan idc about my editor, at least it can run python ok?

And also how do you use that program of yours @AppaXD

@FullyStealth you type the code in the left. on the right is the shell. press ctrl + e to run the code.under source structure is where all the definitions are. thats mostly it
I use gedit texr editor