Python 8ball script
Python Code
+ 1 likes
Please Register to submit score.
| Average Score | 6.5 (of 2 scores) |
| Date Added | Oct 16, 2009 |
| Last Updated | Oct 21, 2009 |
| Tags | 8ball ball eight python |
Introduction
I just started python today so if you want to tell me what I could improve with it that would be great.
*****
Need python 2.6 for this to work.
Save this file to filename.py where filename is a name of your choice
then run it with python filename.py
Python Snippet:
Python 8ball script
Posted on Oct 17, 2009 10:01 am
Posted on Oct 17, 2009 10:01 am
Hm.. If I had to say..
This would be a script for some sort of program.
This would be a script for some sort of program.
Python Snippet:
Python 8ball script
Posted on Oct 17, 2009 3:47 pm
Posted on Oct 17, 2009 3:47 pm
RePod, i would not say that. This is some really messy code! If this was in a program I think I would cry...
Python Snippet:
Python 8ball script
Posted on Oct 17, 2009 5:35 pm
Posted on Oct 17, 2009 5:35 pm
What's so messy about it?
Python Snippet:
Python 8ball script
Posted on Oct 20, 2009 6:31 pm
Posted on Oct 20, 2009 6:31 pm
#! /usr/bin/env python
1. ^ Weird way to do that.
2. Indention is wacko! Very strange.
3. Not commented very good (for those of them who care [not me])
1. ^ Weird way to do that.
2. Indention is wacko! Very strange.
3. Not commented very good (for those of them who care [not me])
Python Snippet:
Python 8ball script
Posted on Oct 20, 2009 7:01 pm
Posted on Oct 20, 2009 7:01 pm
Not commenting doesn't make something messy, it's a simple set of if statements, pretty self-explanatory...
Python Snippet:
Python 8ball script
Posted on Oct 21, 2009 5:05 am
Posted on Oct 21, 2009 5:05 am
mountaindew > patx, gf.
Python Snippet:
Python 8ball script
Posted on Oct 22, 2009 8:17 pm
Posted on Oct 22, 2009 8:17 pm
I don't do python, so this is a wild stab in the dark really, doesn't the while loop need a closing statement, the languages i use all have them, but like i said, i don't do python...hsss.. 8-)
Python Snippet:
Python 8ball script
Posted on Oct 26, 2009 3:34 pm
Posted on Oct 26, 2009 3:34 pm
Python is so wonderful it doesn't need a closing statement.
Python Snippet:
Python 8ball script
Posted on Oct 30, 2009 8:18 pm
Posted on Oct 30, 2009 8:18 pm
| Code: |
#!/usr/bin/env python import random x = raw_input("Please ask a question: ") n = random.randint(1, 7) if n == (1): print("The answer lies in your heart") elif n == (2): print("I do not know") elif n == (3): print("Almost certainly") elif n == (4): print("No") elif n == (5): print ("Why do you need to ask?") elif n == (6): print("Go away. I do not wish to answer at this time.") elif n == (7): print("Time will only tell") |
^ cleaner simpler and more standard way of doing it.








