14,952 Topics

Member Avatar for
Member Avatar for RMartins

Can anybody tell me how can i avoid the overflow of this program? from math import sqrt f=lambda n: sum([int(i)*int(i) for i in str(n)]) L=[] for n in range(0,10**20): if sqrt(f(n))%1==0:# == float(int(sqrt(f(n)))): L.append(n) L.sort() print "NĂºmero de quadrados perfeitos na lista:",len(L) print L y= lambda L: reduce(lambda x,y: x+y,L) …

Member Avatar for G-Do
0
82
Member Avatar for jrcagle

Hi all, This is the beginning of a hopefully useful project: to create a Canvas widget for wxPython that will mimic or improve on the Tkinter Canvas widget. Those of you who have coded with both will probably know what I'm talking about. With Tkinter, you can plop items like …

Member Avatar for BJSH
1
531
Member Avatar for turnerca902

Hi folks, I believe this is a simple task, but I'm having problems getting things to work the way I would expect them to. What I have is a master file containing about 1000 lines. Each line looks like this: 2008_06_01 07:55 24.8 83.1 What I need to do is …

Member Avatar for turnerca902
0
111
Member Avatar for Jozin_z_Bazin

Hi I was create a form in Qt Designer and saved as UR.ui (main title of this forms is "MainWindow") next write in terminal: pyqt4 UR.ui > UR.py and open created file UR.py and write: import sys from PyQt4 import QtCore, QtGui from UR import Ui_MainWindow class StartQT4(QtGui.QMainWindow): def __init__(self, …

Member Avatar for nish88
0
137
Member Avatar for nish88

hi everybody..... i'm using an array to make a program but i'm not able to find the size (length) of the array.can anyone tell me how to do this?

Member Avatar for nish88
0
241
Member Avatar for alexgv14

I have a .txt log file and must of it is crap. But there are parts that display when a user logs in, and at what time the logged in. Below is a portion of the log file. For example, "user1" is a user logging in and "user2" is another …

Member Avatar for jrcagle
0
106
Member Avatar for h0bbit51

So, here's the deal. I am making a pretty simple program, but I seem to have a major problem. I have a loop in the code that is supposed to keep executing a command until the user presses a button. The problem is, I cannot figure out what I should …

Member Avatar for h0bbit51
0
71
Member Avatar for what_is_that???
Member Avatar for Ene Uran
0
41
Member Avatar for mlattanzi

Dear all, this is my first post on the Forum, so hello everybody! :) I am newby with Python (I have only 4 days experience), I have started to leanr because I will need to develop some software to the company I working in. Currently I am developing a code …

Member Avatar for Ene Uran
0
167
Member Avatar for mjsinpl

Hey guys. I have to create an alarm clock in python. i really really need some help in creating this thing.. seeing that i have absolutely no clue what i am doing. I have found some basic code that supposedly makes a clock which updates but the bleeeding thing just …

Member Avatar for Ene Uran
0
679
Member Avatar for nish88

hi everyone....... i am writing a program where i have 2 ovals and i want my first oval to appear then after 2 seconds the second one...but am failing in doing this. can anyone help me to do this please. thank you in advance here is my code [ICODE] from …

Member Avatar for nish88
0
170
Member Avatar for Impact4ever

Hi guys, I have a friend at school and she's taken Unix 2. She gave me a copy of her work assignment so that I could improve my scripting skills (Still a begginner at python and programming). This is the assignment: Write a script that will prompt the user to …

Member Avatar for Impact4ever
0
74
Member Avatar for nikoasumi

Hi, I am new to python and new to this forum. So how are you all? What I am trying to do is create a script editor, with syntax highlight and unicdoe support. It doesnt need to link to ANY compiler, it simply have to display my script with highlights, …

Member Avatar for nikoasumi
0
218
Member Avatar for Carlo Gambino

I am working to increment lists in such a way that each item in the list is incremented incrementally, it sounds confusing but its not: If the user inputs: [CODE]list = [1, 2, 3, 4] [/CODE] I want the output to be: [CODE]2, 4, 6, 8[/CODE] in essence, the first …

Member Avatar for jrcagle
0
141
Member Avatar for RMartins

does anybody knows why this function doesn´t work very well: f=lambda n: reduce(lambda x,y:x**2+y**2, map(int,str(n))) I want that this function add the square of the digits of a number an example of what i want: f(442)=4**2+4**2+2**2=36 and it's giving me f(442)=1028!!!:S However fou numbers with 2 digits the function works!

Member Avatar for Ene Uran
0
167
Member Avatar for implor

I have a string that loks like "u'mystring'". i'm wondering if ther is a easy way to remove the u'' part of the string?

Member Avatar for jrcagle
0
16K
Member Avatar for nish88

[B] Have someone ever implement game of life without using cell??? just using a plain interface like tkinter and rectangle. [/B]

Member Avatar for jrcagle
0
37
Member Avatar for StepIre

Hi Guys, I have a nested dictionary that i would like to be populated from a file at the start of my prog and put back into the file at the end of the prog. Could anyone direct me to somewhere where i could get info on how to do …

Member Avatar for StepIre
0
126
Member Avatar for petr2008

Hi, I am using Python 2.4.4 and: from numpy import * from MA import * I am using masked data in arrays and functions: average, min and max. When the last item of an array is masked, I am getting "masked" results for min and max functions, even if there …

Member Avatar for petr2008
0
62
Member Avatar for nirmalarasu

Hi All, Currently Iam writing python ftp script to upload a file to FTP Server. The server where iam going to download a file expects the upload command in this format "put <filename> flash" I dont know how to send this same command in ftp session after login. I have …

Member Avatar for nirmalarasu
0
436
Member Avatar for mmxbass

Well I got past most of the problems with my boxlets application. I wanted to hear what people think of the functionality and if they have any input/suggestions. Known issues: * When you already have applications open, their boxlets pile up on top of each other. Remember, this software requires …

0
66
Member Avatar for rbracco

I have a server with access to 9 different IP addresses that I want to use for different purposes and I wish to keep them separated. I am going to be doing my work using UrlLib2, is there a way I can specify which IP address I am using through …

Member Avatar for BearofNH
0
106
Member Avatar for Carlo Gambino

I am trying to manipulate user input strings using the ord() funtion. This effectively allows me to identify the decimal value of each character in the string. I have been able to return the value of the characters, but what I need to understand is how to store each value …

Member Avatar for Carlo Gambino
0
147
Member Avatar for StepIre

Hey guys, sorry for this, what im sure is simple, but i just cant get it! i have a dictionary for restaurants.. then i have nested dictionaries holding information like when these restaurants open and close. [CODE] Restaurants = { 'Italian' : {"OpenTime" : "11:30", "CloseTime" : "20:30"}, 'Mexican' : …

Member Avatar for StepIre
0
112
Member Avatar for php.mca

Hi All, I am very much new to python.I need an application to generate password protected pdf. Can anyone help me out? Thanx in advance Dushyant Joshi

Member Avatar for php.mca
0
74
Member Avatar for trihaitran

Hi, I've got about 10 functions that all share a bit of code. They all look something like this: [code=python] def func(arg): statement1 statement2 statement3 unique code statement4 statement5 [/code] Each function does similar statements at the beginning and end, but has unique stuff in the middle. Is there a …

Member Avatar for G-Do
0
113
Member Avatar for trihaitran

Hi, My problem is that I have a large function with hundreds of lines. I want to break it apart into smaller functions. The issue is that if I make a module level function, the scope changes and I have to pass the necessary variables to it. This can be …

Member Avatar for woooee
0
96
Member Avatar for roelandt

Hi I'm new in python and i'm do not understand why my code is not working. I want to generated random figures with this code: import random import division a1 = '' a2 = '' def zufallsZahl(a1,a2): a1 = random.randint(1,10) a2 = random.randint(1,10) print a1, a2 s1 = [a1, a2] …

Member Avatar for woooee
0
97
Member Avatar for pythoxine

what is the best language-related python library, with support for spell checking (aspell?)?

Member Avatar for vegaseat
0
76
Member Avatar for G-Do

Hi all, I added a new script to the code snippets page. This time, it's a logic puzzle called "Petals Around the Rose." The goal is for you to infer what algorithm is being used to "score" rolls of five colored dice without peeking at the code. The snippet is …

Member Avatar for jrcagle
0
193

The End.