15,190 Topics

Member Avatar for
Member Avatar for athulram

Hey all. I have this program where I need a variable number of for loops. For eg. the program i use to find the pythogorean triplets is for n1 in range(100): for n2 in range(100): for n3 in range(100): if n1**2+n2**2 == n3**2: print str(n1**2) + '+' + str(n2**2) + …

Member Avatar for athulram
0
4K
Member Avatar for sean.kallungal

I am trying to write a program in Python that converts user input from English to Pig Latin ("Y" is not a vowel in this case, breaks off at first vowel and moves preceding consonants to the end). The end product of my program should be able to compute whole …

Member Avatar for M.S.
0
675
Member Avatar for M.S.

This is and answer to one of the Vegaseat's recent projects for beginners. I share my solution here because -as a begginer and do learn python as a hobby- I need your feedback. So please tell me am I doing it the right way? Thanks in advance for comments from …

Member Avatar for M.S.
0
309
Member Avatar for PythonMonty

# convert2.py # PPython Monty # Lab 2 Ch 2, PE 4 # A program to convert temperatures from Celsius to Fahrenheit and # vice versa def main(): # description of program print("This program converts Celsius temperatures to Fahrenheit and") print("vice versa.") conversion = ("C") n = eval(input("How many temperatures …

Member Avatar for HiHe
0
787
Member Avatar for Patrick.Barklem

Hi there, im relatively new to python and i just can't figure out parameters... Any help with this code? def main(): getInputs() answer = calculateWork() print (answer) def getInputs(a,b): num1 = int(input("Please enter your first number: ")) num2 = int(input("Please enter your second number ")) return num1,num2 def calculateWork(): return …

Member Avatar for vegaseat
0
160
Member Avatar for pynehalem

To All Pythonist.. I have small SQLITE db.. for User Table 'SELECT loginUser from User'; sql = cursor.fetchall() listSQL = sql[:] for x in listSQL: print x listSQL SELECT Data Produce: (u'user1',) (u'user2',) (u'user3',) I want to match the list of user with a string input: example if the value …

Member Avatar for woooee
0
322
Member Avatar for ddree

An employee is paid at a rate of $20.75 per hour for regular hours worked in a week. Regular hours are up to and including 40 hours per week. Any hours in a week worked over regular hours are paid at the overtime rate of time and a half (i.e. …

Member Avatar for woooee
0
1K
Member Avatar for sainitin

I have 29 text files as follows File 1 12313 : 23546 12313 23214 32465 File 2 13132 : 23546 12323 32125 32125 32121 . . . I would like to have python script which computes intersection between these files ideal result as follow 12313 : 23546 13132 : 23546

Member Avatar for vegaseat
0
220
Member Avatar for hotblink

Hi there, newbie to python and in need of help for an assignment. I have to write a Python program that prompts the user to input the before-tax price of an item and the payment from the customer. It should then perform two tasks. First, compute and display the after-tax …

Member Avatar for Xantipius
0
434
Member Avatar for ejohnson

I downloaded Python 3.2.3 from the python.org web site. However, when I click to launch the python command line the initial message from windows is as follows: "Please waite while windows configures python 3.2.3. Using this link Python 3.2.3 Windows x86 MSI Installer (Windows binary -- does not include source) …

Member Avatar for vegaseat
0
499
Member Avatar for Amy_3

I am new to python. How to instantiate object from parsing a file? I got a error. File "/home/Bunny.py", line 23, in main mapgrid[i].append(Spot(myLine[j] == 'B')) TypeError: 'module' object is not callable The first line of input is the number of simulations. The next line isthe number of minutes for …

Member Avatar for Xantipius
0
277
Member Avatar for rmbrown09

Just a quick question, why does the first findall print out hello but the second just gives me brackets with nothing in them. I want it to show me everything that matched. Which in this case should be everything. k = "hello there how are you" print re.findall(r'hello',k) print re.findall(r'\w+',k)

Member Avatar for rmbrown09
0
58
Member Avatar for littleEuler

def main(): celsius = float(input("What is the Celsius temperature? ") fahrenheit = (9/5) * celsius + 32 print ("The temperature is ", fahrenheit, " degrees Fahrenheit.") main() error output: Syntax Error:(line 8) fahrenheit = (9/5) * celsius + 32 This makes perfect sense to me. How can i fix this …

Member Avatar for hughesadam_87
0
108
Member Avatar for mandroid

Hello all, first time poster here. I've tried searching for a thread which deals with my current problem both here and in Google, but few people seem to need help with PyFluidSynth as compared to Jack, so I am starting a new thread. If anyone knows of another thread where …

0
126
Member Avatar for M.S.

this is my first attempt to implement OOP. IS this class ok?(in terms of structure) AND another Question: there are some folders in message application in Symbian phones and sometimes there are up to 1000 messages in each folders. I do itterate over all messages for gathering their info about …

Member Avatar for M.S.
0
172
Member Avatar for Gribouillis

This snippet allows one to implement an equivalent of a `__getattr__()` function in a python module. The module can then define its own way to lazily import abitrary symbols. For example the module can contain infinitely many names or load values from other modules on demand. There are many implementations …

Member Avatar for Gribouillis
1
517
Member Avatar for bryceburry

Well, I'm making a tic-tac-toe game in Python **2.7**, and I need a code snippet to "make" the AI want to get a Tic-Tac-Toe, and make the game end if there's a **draw**. What can I do? This is the code as it is: # Python Tic Tac Toe import …

Member Avatar for TrustyTony
0
444
Member Avatar for dboxall1234

hi i've recently been learning about python on cssciencecircles.com. After a while i decided to download it so i can save some of my programmes. When i make a programme in the IDLE shell and save it, even the most simple instructions, eg. print('hello world') , when i try to …

Member Avatar for dboxall1234
0
747
Member Avatar for rbsmith333

Having a hard time getting this to work. options = [ 'option 1', 'option 2', 'option 3' ] for x in range(len(options)): Opt = str(x + 1) print('(' + Opt + ')', options[x]) while True: try: playerOpt = int(input('input ')) check = 'fail' for x in range(len(options)): Opt = x …

Member Avatar for rbsmith333
0
193
Member Avatar for supravat

Hi, I am writing some code for android using python. I want to control the visibility of bluetooth ( i.e on or off of the bluetooth visibility) using some python script. Can you please help me ?

Member Avatar for M.S.
0
309
Member Avatar for jim.lindberg1

Hi! I have a beginners problem I really need some help with. First of all, here is my current program: def texten(): filehandle=open ( 'savetonight.txt', 'r' ) text=filehandle.read() return text def smabokstavertext(): texten() print text.lower() I basically want my function smabokstavertext() to call the first function texten() and then print …

Member Avatar for hughesadam_87
0
137
Member Avatar for crishein14

hi guys .. Im here again ! I dont know how to explain this .. Here's my example : [url]http://desmond.imageshack.us/Himg228/scaled.php?server=228&filename=screenshotzjj.jpg&res=landing[/url] i want to know how to make a code like my example .. An icons and a cursor ! Im using s60v2 os8.1 .. Thanks !

Member Avatar for M.S.
0
103
Member Avatar for crishein14

Hello everyone .. Im new in python and i have a question ! How to compile myfile.py to myfile.pyo ? Can you give me an example script coz i dont know were to put python -0 to compile it into pyo ! Thanks a lot ..

Member Avatar for M.S.
0
3K
Member Avatar for crishein14

it is possible to start a python apps when you start your phone ? Im using s60v2 N70-1 .. Is there a python code autostart for my phone ? Please help ..

Member Avatar for M.S.
0
171
Member Avatar for crishein14

Can anyone HELP me for my problem .. Im a newbie in python ! I want to create a script to rename files in a dir. that dir has 400 files .png .. startswith 001.png , 002.png to 400.png ! I want to rename them startswith 000.png to 399.png .. …

Member Avatar for M.S.
0
170
Member Avatar for lewashby

movies = ["The Holy Grail", 1975, "Terry Jones & Terry Gilliam", 91, ["Graham Chapman", ["Michael Palin", "John Cleese", "Terry Gilliam", "Eric Idle", "Terry Jones"]]] print(movies[4][1][3]) In the above code, how does [4][1][3] result in "Eric Idle"? It looks to me like the 4 selects Eric Idle becaue it's the 4th …

Member Avatar for ~s.o.s~
0
146
Member Avatar for rbsmith333

I'm trying to figure out how to use '%s'. I looked it up in the python docs but it never actually shows how to use it. This is the line I'm working on right now just to figure it out. It is the first one of different variations where the …

Member Avatar for rbsmith333
0
1K
Member Avatar for TheSkunkMan

I've playing with pygame a little and reading about it and i tried to make a simple rock paper scrissors game. I can't seem to get fullscreen working. Everything i've tried or read didnt work. Can u please help me? thanks

Member Avatar for alexpinho98
0
3K
Member Avatar for yindra.puentes

hello! I'd like to rank a numpy array without getting the number positions changed. I was able to do it using the numpy function below but it keeps ranking the 'NaN' values as well, how can I get it to ignore them and just rank the real number values instead. …

Member Avatar for TrustyTony
0
389
Member Avatar for oscargrower11

I'm trying to do something simple like get calc.exe to start minimized, but it's not happening. import subprocess import win32gui import win32con info = subprocess.STARTUPINFO() info.dwFlags |= subprocess.STARTF_USESHOWWINDOW info.wShowWindow = win32con.SW_SHOWMINIMIZED x = subprocess.Popen("calc.exe", startupinfo = info) It pops up the same as always, no matter what I provide for …

Member Avatar for TrustyTony
0
346

The End.