Forum: Python Jul 5th, 2009 |
| Replies: 4 Views: 390 Assuming you are using Python2, you could do it like this:
print("Enter zero for the value you are looking for:")
s = d = t = 0
while True:
s = input("Speed (miles/hour): ")
d =... |
Forum: Python Jul 2nd, 2009 |
| Replies: 12 Views: 650 Thanks for the info jlm699! |
Forum: Python Jul 2nd, 2009 |
| Replies: 12 Views: 650 There must be something wrong at sourceforge, right now every download request for wxpython2.8 flips into the wxPython2.7.1.2 page :)
This direct link may work:... |
Forum: Python Jul 1st, 2009 |
| Replies: 12 Views: 522 Forgot to mention this, but I also corrected line 10 to:
self.fileMenu.Append(ID_FILE_QUIT, '&Quit\tCtrl+Q') |
Forum: Python Jul 1st, 2009 |
| Replies: 6 Views: 283 Zetlin, your code was almost there:
def test():
number = input("Number: ")
scale = range(1, number+1)
total = 0
for count in scale:
n = count * 20
print n
... |
Forum: Python Jul 1st, 2009 |
| Replies: 7 Views: 361 I ran this from the IDLE editor:
s = u'Rash\u00f4mon'
print s # --> Rashômon
a = u'\u00bfC\u00f3mo es usted?'
print a # --> ¿Cómo es usted? |
Forum: Python Jul 1st, 2009 |
| Replies: 5 Views: 2,436 Use something like this:
s = "Function1 (text1) (text2) (text3) [text4]"
print s.count('(')
print s.count(')')
print s.count('[')
print s.count(']') |
Forum: Python Jul 1st, 2009 |
| Replies: 7 Views: 502 You could use / both Windows and Unix allow that. |
Forum: Python Jul 1st, 2009 |
| Replies: 14 Views: 453 Python code is actually very similar to your Perl code, just a bit more readable:
# Convert string "HelloPythonWorld" to "HELLO_PYTHON_WORLD"
s1 = "HelloPythonWorld"
s2 = ""
for index, c in... |
Forum: Python Jun 30th, 2009 |
| Replies: 12 Views: 522 If paulthom12345's suggestion does not fix your problem, try to bind this way:
import wx
ID_FILE_QUIT = 101
class MainFrame(wx.Frame):
def __init__(self, title):
... |
Forum: Python Jun 30th, 2009 |
| Replies: 3 Views: 1,369 Try to change your print line to:
print ("The sum of "+str(a)+" and "+str(b)+" is: "+str(a+b))
or even better:
print ("The sum of %s and %s is: %s " % (a, b, (a+b)))
Now remember in Python2... |
Forum: Python Sep 28th, 2008 |
| Replies: 9 Views: 2,530 Try this:
num = [1,2,3,4,5,6]
print sum(num) |
Forum: Python Sep 16th, 2008 |
| Replies: 12 Views: 4,108 This will give you an error:
Traceback (most recent call last):
File "<module1>", line 23, in <module>
File "<module1>", line 21, in test
TypeError: test() takes exactly 1 argument (0 given) |
Forum: Python Sep 8th, 2008 |
| Replies: 3 Views: 995 You could also make up your time string this way:
import time
time_str = time.strftime("%A %B %d %Y %H hours %M minutes and %S seconds",
time.localtime())
print time_str # Monday... |
Forum: Python Aug 15th, 2008 |
| Replies: 10 Views: 1,135 Oh yeah, like:
print 'racecar' == 'racecar'[::-1] # True
:) |
Forum: Python May 27th, 2008 |
| Replies: 16 Views: 4,147 You might have to uninstall a partially installed version of eric before reinstalling. I would stick with an IDE that uses wxPython as its GUI toolkit, like DrPython, Boa or PythonWin. |
Forum: Python Feb 25th, 2008 |
| Replies: 3 Views: 613 This is something similar to what you coded. I didn't use the 'clear the screen' thingy because that would make it OS specific, and our instructor says that it is better to leave a record on the... |
Forum: Python Oct 22nd, 2007 |
| Replies: 8 Views: 1,993 I am primarily using C# (that's what my school uses), but enjoy looking into Python code. I am looking at the many code samples shown here, and find them so much easier to understand and read than... |
Forum: Python Apr 17th, 2007 |
| Replies: 3 Views: 2,193 I had the same problem until I figured out that the Text widget width is in characters and the height in text lines. Makes it easier for text, but harder for overall sizing. |
Forum: Python Mar 11th, 2007 |
| Replies: 8 Views: 4,052 I am a little confused with the 'string.split(s)' I thought it was more like s.split():
s = "Just a test string"
words = s.split()
print words
Are there different versions of Python floating... |
Forum: Python Mar 8th, 2007 |
| Replies: 6 Views: 7,121 Sounds interesting, so i put it all together:
message = "just a simple test!"
key = 11
coded_message = ""
for ch in message:
code_val = ord(ch) + key
if ch.isalpha():
if... |