15,175 Topics

Member Avatar for
Member Avatar for kjock002

i'm writing a program that reads the lines of a file. each line has a name and and number separated by one space. i want to split the string but i only want the number because i'm using it in calculations. i've skimmed through the python docs and i'm still …

Member Avatar for TrustyTony
-3
230
Member Avatar for adam321

[CODE][/CODE] def Given(rn): Given_lengths = [0] * 1000000 def rn2(n): if not Given_lengths[n]: Given_lengths[n] = rn(n) return memoized_lengths[n] return rn2 def cycle_length(n): if n == 1: return 1 if n % 2: return cycle_length(n * 3 + 1) + 1 return cycle_length(n / 2) + 1 def problem(i,j): for x …

Member Avatar for jcao219
0
172
Member Avatar for prashanth s j

Hi all, I tried running the following code. [code] #! /usr/local/bin/python import threading import time print "Press any key to start timer!" input() threadBreak = False def TimeProcess(): while not threadBreak: print "How are you?" print (time.time() - startTime) startTime = time.time() threading.Thread(target = TimeProcess).start() input() threadBreak = True input …

Member Avatar for woooee
0
112
Member Avatar for srk619

im looking for a python mud game example which i could see the coding and make my own mud, the thing is that im very new to mud if i was able to see an example of a game working then i would be able to understand what coding classes …

Member Avatar for ultimatebuster
0
780
Member Avatar for spacemandan

For my CS1 class we have to write a simple battleship game. I'm having trouble even knowing where to begin. After I get a basic skeleton of functions and classes I think I will know where to begin. We have to use the Zelle graphics.py module ANY help would be …

Member Avatar for ultimatebuster
0
87
Member Avatar for ShadyTyrant

Well I have reflected on why my first proposal for a open source project failed. We had no base to build on, and there was to much administrivia that made us loose interest in the project. Since then I have come up with a new project idea. I started simple …

0
99
Member Avatar for jcao219

I personally prefer the 3 syntax over 2, but I notice most of the code snippets in this forum are for Python 2. Is it because we are still in a steady transition from 2 to 3, or is it something else?

Member Avatar for hondros
0
205
Member Avatar for basti!

Hey, can somebody help me. I have to do a programm from school. I a complete newbie in python. Can somebody tell me why my programm doesn't work and what i can do. thanks here it is: [CODE]import matplotlib import numpy import pylab lam = pylab.linspace(0.1,100,1000)*10**-6 pylab.xlabel('Wellenlaenge (mM)') pylab.ylabel('Temperatur (T)') …

Member Avatar for woooee
-3
176
Member Avatar for Soren Werk

I'm getting started with Django on Windows. And the tutorial [URL="http://docs.djangoproject.com/en/dev/intro/tutorial01/"]http://docs.djangoproject.com/en/dev/intro/tutorial01/[/URL] has me running "python manage.py <command>" from a command promt all the time. But I'm wondering: Couldn't I run the manage.py commands from PythonWin or IDLE?

Member Avatar for TrustyTony
0
113
Member Avatar for ITgirl2010

[code=syntax] #calculate the amout of tax due to the tax given income def calTax( income ): tax = 0 if income <25000: tax = income * 0.25 elif income > 25000 and income < 50000: tax = 25000 * 0.25 + (income - 25000) * 0.33 elif income > 50000: …

Member Avatar for JasonHippy
0
1K
Member Avatar for gunbuster363

The methods is so complicated. I want to check the execution time of each statement so that I can modify that part in order to increase speed. Thanks in advance, Raymond

Member Avatar for hondros
0
94
Member Avatar for richardtreier

Maybe you know the mmotps GunZ([URL="http://trinityent.org"]http://trinityent.org/home[/URL]). i have already written a few macros for it (so a program, which clicks and presses the keys for you ingame) with the program actool([URL="http://www.actool.net/"]http://www.actool.net/[/URL]). But i am tired of using this pascal-like programming language... [B]So is there a possibility to get a macro, …

Member Avatar for richardtreier
0
218
Member Avatar for ITgirl2010

''' Calculate the BMI of a person given their height and weight ''' def calcBMI( h, w ): BMI = w / h**2 return BMI def main(): height = float(raw_input("Enter height in metres: ")) weight = float(raw_input("Enter weight in kilos: ")) BMI = calcBMI(height, weight) print "BMI = %0.1f" % …

Member Avatar for ITgirl2010
0
213
Member Avatar for paquerettee

Hi, could you tell me where I can find some information about regex engine optimizations used by Python regex engine?

0
22
Member Avatar for sob_andizzle

i have to write a code that tells the user to enter the amount of minutes they were allowed to use, it has to be between 200 and 800 if it exceeds or goes below then it should print "please enter minutes between 200 and 800" the problem is: if …

Member Avatar for jice
0
142
Member Avatar for kur3k

Hello My english is not good, so pleas - understat me ;-) I have two question about python ;) 1. I'm from poland, in poland letter a == Ä…, z == ź itp. Can i remove polsich letter? example in input - jacek bÄ…k in output - jacek bak I …

Member Avatar for jice
0
667
Member Avatar for Purnima12

[CODE] while True: try: wd = int(input('How wide would you like your letter to be? (5 - 20)' + ': ')) break except ValueError: print ("Oops! That was no valid number. Try again...")[/CODE] If the user inserts a number that is not 5 - 20, I want the program to …

Member Avatar for TrustyTony
0
540
Member Avatar for jozz3

How would you define a recursive function that asks the user for a string and prints it from the outside in. For example, 123456 would print as 162534. Any help would be appreciated.

Member Avatar for jozz3
0
570
Member Avatar for sob_andizzle

please please please help me this is my last program i have to write and i am having difficulty, this could mean a pass or fail. Thank you for your patience and help. I need a very simple code that asks the user, #input the minutes that are allowed how …

Member Avatar for sob_andizzle
0
102
Member Avatar for ihatehippies

[CODE=python]>>> import wx >>> wx.NullBitmap.SubBitmap Traceback (most recent call last): File "<pyshell#0>", line 1, in <module> wx.NullBitmap.SubBitmap File "C:\Python25\lib\site-packages\wx-2.8-msw-unicode\wx\_gdi.py", line 659, in GetSubBitmap return _gdi_.Bitmap_GetSubBitmap(*args, **kwargs) TypeError: Bitmap_GetSubBitmap() takes exactly 2 arguments (1 given)[/CODE] I didn't call it, I just tried to reference it. happens with all these methods wx.DefaultDateTime.Day …

Member Avatar for ihatehippies
0
222
Member Avatar for ITgirl2010

Ive started with this program def calcFinal(): while True: try: asg1Mark = int(raw_input("Enter Asg1 mark: ")) asg2Mark = int(raw_input("Enter Asg2 mark: ")) examMark = int(raw_input("Enter Exam mark: ")) final = asg1Mark + asg2Mark + examMark return final except ValueError: print 'Please enter only numbers' def mark_check(finalMark): print "Final mark is …

Member Avatar for woooee
0
112
Member Avatar for Stev0

Several weeks ago, I wrote a simple web crawler that was designed to simply retrieve robots.txt from a range of IP addresses. It was entirely CLI based, and I had it working perfectly. As my python experience has increased, I decided to start learning about GUI based programming, and decided …

Member Avatar for Stev0
0
162
Member Avatar for Hoban

First off this is for a homework assignment and I am new to python. I have attempted to tweak an example of how to make a table from another post on this forum but with no luck. Here are my problems: 1) my range is small (0, 1, 0.1) This …

Member Avatar for vegaseat
0
113
Member Avatar for goodwin912

I've got a little app to resize and watermark images. At the moment it only does one at a time but I would like to get it to do a full folder of images in one go. I have done this previously in VB using loops but im new to …

Member Avatar for Tech B
0
229
Member Avatar for ktsangop

Hi everybody. Could someone explain me the usage of python's modulo operator and/or the fmod function? why do i get these results? >>> 23%0.1 0.099999999999998729 >>> import math >>> math.fmod(23,0.1) 0.099999999999998729 >>> normally 23 mod 0.1 = 0 because 23 / 0.1 = 230 exactly is there anything wrong there …

Member Avatar for ktsangop
0
241
Member Avatar for kjock002

the random function gives you a number between 0.0 and 1.0 . im trying to get a random number between -0.5 and 0.5. i asked someone for help and they told me to go off of this: [0, 1) + .1 this changes the range to [1, 2) and i …

Member Avatar for Gribouillis
0
98
Member Avatar for leviaeon

i am really wondering why this type of error continues to occur for every bluetooth code i try.. i am trying to connect to a bluetooth module... i am wondering why i cant connect to that module where in i can connect to other devices like mobile phone and laptops... …

0
58
Member Avatar for leviaeon

i have an error with this sample code i got from the net... the error says: TypeError: unsupported operand types for +: 'int' and 'str' here is the code: from time import ctime [COLOR="Red"]import[/COLOR] codecs [COLOR="red"]import[/COLOR] inbox, appuifw box = inbox.Inbox() msg = box.sms_messages() f = [COLOR="red"]codecs.[/COLOR][COLOR="Green"]open[/COLOR]('E:/Others/listSMS.txt', 'w', 'utf8') # …

Member Avatar for leviaeon
0
89
Member Avatar for LostGurl

Hello.. Im doing some simple text processing using Python which include indexing, splitting and tokenizing text from folder. i want to improve the stemming and tagging process using MontyLingua by importing the Monty library for tokenizing and tagging. I dont know how to edit and call them in my coding. …

Member Avatar for PassBy
0
483
Member Avatar for kjock002

the program below simulates a game of craps and its pretty much done except for a way to get the while loop to stop. i was trying to get an input from the user when they wanted to stop rolling and to enter "n" for no but im not sure …

Member Avatar for jcao219
0
115

The End.