14,946 Topics

Member Avatar for
Member Avatar for Gribouillis

This snippet defines a function to merge sorted iterables containing similar items into a single iterable. Items are supposed to be sorted in ascending order. Only one item per iterable is stored at a time.

Member Avatar for Gribouillis
0
584
Member Avatar for longlongsilver

python code to create a Class called Car for automobile objects. The class constructor a color attribute. Be sure to include a constructor with the color parameter. The constructor should include a message that a Car of the appropriate color has been created. here is my code: [CODE]class Car(object): """A …

Member Avatar for Gribouillis
0
88
Member Avatar for jrp370

im trying to edit this class so it takes a letter grade instead of a number to find the gpa but im at a total loss any ideas? [code]class Student: def __init__(self, name, hours, qpoints): self.name = name self.hours = float(hours) self.qpoints = float(qpoints) def getName(self,name): #name=input("what is the students …

0
62
Member Avatar for Smed

I'm trying to search a specified range of numbers and I'm currently using regular expressions. The lines I'm searching contain numbers from 00 to 30, but I only want to find the lines containing 02 to 22. I have tried a few different things, but none of them work. this …

Member Avatar for TrustyTony
0
72
Member Avatar for nejger

Hello! (I would like to use tkinter. ) I'm going to do my program who convert roman letters to arabic numbers and vise versa. I'm going to do two buttons and a textfield where you can write in the number or letters and then choose if you want it transelate …

Member Avatar for TrustyTony
0
119
Member Avatar for Dinnerfortwo

Hi, im trying to figure out how to call a function's variable from here [CODE]def legal_moves(board): moves = [] for square in range(DINNER): if board [square] == SPACE: moves.append(square) return moves[/CODE] I want to take the variable moves and use it for main How would I do that?

Member Avatar for TrustyTony
0
81
Member Avatar for parijat24

[CODE]ENSTRUG00000000009 ENSTRUT00000000011 1026 509 5896 ENSTRUG00000000011 ENSTRUT00000000014 420 63 482 ENSTRUG00000000012 ENSTRUT00000000015 10902 15313 93157 ENSTRUG00000000012 ENSTRUT00000000016 2844 23243 60985 [/CODE] as this is my input file it has five coloumns and there is for each line , we have to identify unique entry from the first coloumns which high …

Member Avatar for TrustyTony
0
130
Member Avatar for 3FLryan

I did an accidental overwrite of the pre-instealled Python framework in the System directory of my Mac running OSX 10.5.9. From the official Python website: "The Apple-provided build of Python is installed in /System/Library/Frameworks/Python.framework and /usr/bin/python, respectively. You should never modify or delete these, as they are Apple-controlled and are …

Member Avatar for 3FLryan
0
219
Member Avatar for Friendly Lotus

Hi all, I am trying to update the colour of a Tkinter label, so as the value of a variable changes so to does the colour of the text. Below is a simple example of what I am trying to achieve, but the problem is when I press the button …

Member Avatar for TrustyTony
0
15K
Member Avatar for br0wnm4n

Hi, I am having some trouble writing this code. The question is as follows: The Sieve of Erastophenes is an algorithm -- known to ancient greeks -- that finds all prime numbers up to a given number n. It does this by first creating a list L from 2 to …

Member Avatar for TrustyTony
0
139
Member Avatar for beginninphp

Hello all, I've been stumbling (more like Stumbling, I hope) across the web looking for something that can do occasional screen captures using a cron job on my casual gaming site server. I was hoping to be able to save screen captures of a few characters as I leveled them …

0
190
Member Avatar for anna514

Srpn is a reverse polish notation calculator with the extra feature that all arithmetic is saturated (i.e. when it reaches the maximum value that can be stored in a variable, it stays at the maximum rather than wrapping around). Program must be able to input at least two numbers and …

Member Avatar for slate
0
607
Member Avatar for ekkanh

[CODE]def work(here): variabel = "Hi" x1.here(variabel)[/CODE] How can I make here as a local parameter? that will work for calling other functions?

Member Avatar for TrustyTony
-1
94
Member Avatar for jice

hi, I try to write a app to automatically re-organize my mails (thunderbird). The first thing I try is to re-create my folders tree, once for each year. So i need to read mbox files and rewrite them [CODE=python] import mailbox mbx=mailbox.mbox("./in_mbox") mbx.lock() of=open("out_mbox", "w") for k, m in mbx.iteritems(): …

Member Avatar for jice
0
182
Member Avatar for chalasesha

hi all, i just doing Django..tried the first example in Django book...i encountered problem at admin page. it says that admin is not defined. i followed each step in tutorial and i am able to run django server also. pls help me to solve it. i am adding error output …

Member Avatar for sureronald
0
952
Member Avatar for bob24bob

hey, I don't know if you have seen my other post or not, but I have been working on a small code lately to get the users credentials such as their password and username. As you can see, the code gives a warning and says there is a problem with …

Member Avatar for crunchie
0
150
Member Avatar for wazaa

I have just started using python and am trying to write a program that generates 200 random numbers in the range (1,50),then counts the number of occurrences of each number and prints the frequency of occurrence. I have created the part of the code which generates the random numbers. I …

Member Avatar for wazaa
0
3K
Member Avatar for c2q

Hi. I have a function that needs to split a string on the seperators given by the function. so if i had the seperators as !.?: then it should split the string at those points. if i have a string 'hello. world! hello.' how can i return a list with …

Member Avatar for ultimatebuster
0
606
Member Avatar for Smed

I'm trying to sort a 3D array and having little success. I have read various methods on how this is done for two dimensions, but I can't seem to scale it up. example array: [CODE]r =[[['steve',1, 40], ['steve',3, 20], ['steve',2, 30]], [['john',5, 50], ['john',6, 40], ['john',4, 30]]][/CODE] I want this …

Member Avatar for TrustyTony
0
204
Member Avatar for nejger

Hello, I'm doing a Converter, from Roman to arabic and the other way. Now I need help to do a program who can do bigger numbers/letters than 3999. I must use the information: (M) is 1000 *1000 and (L)= 50 * 1000 etc. So ( ) means 1000. I must …

Member Avatar for woooee
0
172
Member Avatar for singlem1905

today, I want to transform "c:\*\``"(it is a rout) to "c:/*/''" yes, just from "\" to "/" but it is always missed ,for example "\n" to "enter" and how can "c:\*''" just be "c:\*''" without changing ? thanks a lot!

Member Avatar for TrustyTony
0
75
Member Avatar for ds2000

Hi all, Hopefully a quick one. I have some weblogic build scripts that configure a WebLogic Server environment. Previously DB connection credentials have been allowed to be stored in build property files. However new security regulations mean that this is no longer possible. I am trying to write a prompt …

Member Avatar for ds2000
0
2K
Member Avatar for qdiscoverer

Here's what I made to test how python works.... test.py: [CODE=python] class ECollector: #error msg collector #this class should be used as 'global' msgs = [] def addmsg(self,msg): self.msgs.append(msg) def clear(self): self.msgs = [] class test(ECollector): dcodes = [] ECollector def new(self): ECollector.addmsg("test!") [/CODE] And I typed the following on …

Member Avatar for Gribouillis
0
316
Member Avatar for ccandillo

I am doing the O'reilly School of Technology course and the current topic deals with Tkinter. It gave me the idea to write this application. The idea is to transfer files to various ftp sites. If I set a default master password, then the password should be used for all …

Member Avatar for ccandillo
0
280
Member Avatar for c2q

Hi Okay so i have a text file and i have it converted to a bunch of lists with strings as the words. Now i need to find words that occur only once in the entire text file, how can i do this using a loop? A hint says that …

Member Avatar for cghtkh
0
130
Member Avatar for kafro

I'm working with sets and notice when I do: [CODE]s1 = set( ['a', 'b', 'c']) s2 = set([1,2,3]) print s1.symmetric_difference(s2)[/CODE] It prints it off as: [CODE] set(['a', 1, 2, 3, 'c', 'b'])[/CODE] Is there any reason to why it displays it in the order of 'a', 1, 2, 3, 'c', …

Member Avatar for TrustyTony
0
109
Member Avatar for kiddo39

Hi, I've been using tkinter to write a program that has a root window and many toplevel windows. I was able to create them successfully but my next step was to incorporate mysql with it so it would actually store any data that was entered in the various entry fields. …

Member Avatar for TrustyTony
0
1K
Member Avatar for 3FLryan

Hello, I am just starting learning Python and I am having some trouble properly importing a function from a module. I wrote the short script: [CODE]def print_twice(param): print(param, param) [/CODE] When I try to import the function print_twice, the shell tells me it cannot import the name print_twice. When I …

Member Avatar for TrustyTony
0
450
Member Avatar for king_koder

Hello, I got stuck trying to solve the following problem in Python. I understand that I somehow need to implement Dijkstra's algorithm to solve this problem, but how I've no idea. [B]Inside a room, there is a monster with N heads, and a human (with 1 head). The human has …

Member Avatar for slate
0
502
Member Avatar for python01

I am making a program that requires variable values to be sent to the open window (internet explorer browser) I was wondering if there was a way to do this with a module such as SendKeys because IEC python wont install on my pc thanks for the responses, python01

0
46

The End.