EvilZone
Programming and Scripting => Scripting Languages => : josazee September 20, 2014, 11:25:46 PM
-
Here's a mind reading game I made in python 2 days ago. You choose a number in your mind and the script tries to predict it.
#!/usr/bin/python
import random
print("\nby Eramen.\n\n"
"Choose a Number in your mind from 1-10")
raw_input("\nPress Enter to Continue...")
multNumb = random.randint(1, 9)
addNumb = random.randint(1, 9)
info = "\nMultiply the Number by: "
print info, multNumb
raw_input("\n...")
print("\nDivide the Total by your first number")
raw_input("\n")
info2 = "then add: "
print info2, addNumb
raw_input("\n...")
print("\nAlso add your initial number")
raw_input("\n")
digit = multNumb + addNumb
yourNumb = "\nYour Number should be: "
while True:
value = raw_input("\nNow, what number do you get: ")
if not value.isdigit(): continue
print yourNumb, int(value) - digit,'\n'
break
-
First you could use code tags like [ code= python ] . A mod might help you with that if you don't know how to do it.
Then your code is blotted with alot of try-except clauses which aint at all necessary. i mean the whole program doesn't need any exception handling. You just needed to verify the input.
Please get to that cos i won't do it for you if you have any incling to learn.
-
Thank you, I do want to learn.
-
But you haven't removed the silly try....except clauses; yet still you haven't asked how you could do input validation. It disappoints me that you ain't even trying.
Wasted effort kenjoe41, move on.
Sorry i can't remove them for you and slow you development.
-
I haven't been online for awhile on evilzone, thanks for the reply and i have modified the code.