15,190 Topics

Member Avatar for
Member Avatar for TrustyTony

I post here the code for histogram using the turtle graphics module, which I posted long time ago in discussion thread. For more special graphs there exist other fancier options, but this tkinter based routine can function in most standard installations of Python. Example data.txt, like mentioned in module docstring: …

0
2K
Member Avatar for vlady

Hello Guys! Can anybody help me with this code? So what I need? here is it: I want to fill out global variable "student_marks" with a grade for each student and keep it once is loaded. So it means without calling the function "def add_mark()" I will be able to …

Member Avatar for vlady
0
127
Member Avatar for lrh9

Hand evaluator for Texas Hold'em. If a "hand" has five or more cards, hand.rank will find the best five card hand the hand can form. Two hands can be compared using the comparison operators. The final hand can be gotten from the "hand" with hand.rank.hand. The value used for comparisons …

Member Avatar for lrh9
0
1K
Member Avatar for AdampskiB

Hello there, Currently doing some work for my coursework. I've noticed the "\n" is obviously the new line function or whatever you guys call it, but would you understand what I mean when I say it creates too much of a new line? For example, I want the newline to …

Member Avatar for AdampskiB
0
115
Member Avatar for s00pahFr0g

Hello everyone, I did have a look around with search option to see if I could get an answer their, but I couldn't quite find my issue(at least I don't think I did). This is for a final project for school where I have to create a class for a …

Member Avatar for TrustyTony
0
307
Member Avatar for Flames91

Hey all, I'm trying to write a Polynomial Class but I'm having some trouble. I'm having the coefficients and exponents stored in a dictionary, like so... [CODE] class Polynomial: def __init__(self, *termpairs): self.termdict = dict(termpairs) print (self.termdict) if __name__ == '__main__': d1 = Polynomial((2,3), (4,5), (8,9)) print (d1) [/CODE] This …

Member Avatar for TrustyTony
0
511
Member Avatar for arindam31

Hi Guys, I am trying to make a text box that will accept a password from user.The password should be masked while typing. [CODE]def MyFunc2(self,event): box2=wx.TextEntryDialog(None,"Enter Password","PASSWORD","Waiting",style=wx.TE_PASSWORD) if box2.ShowModal()==wx.ID_OK: global pwd1 pwd1=box2.GetValue()[/CODE] The code is a piece of a program . The above code when run , shows the text …

Member Avatar for arindam31
0
233
Member Avatar for obito

Hi I just started learning programming and tried some looping with file management. I am not sure how to join the string after looping can someone give me some pointers how can i go about doing it? Thanks! This is my code [CODE] import string testFile = open("test.txt", "r").readlines() for …

Member Avatar for TrustyTony
0
108
Member Avatar for petergeng

Im trying to call python functions from C code, and i followed a sample from here [URL="http://docs.python.org/release/2.3.2/ext/pure-embedding.html"]http://docs.python.org/release/2.3.2/ext/pure-embedding.html[/URL] I also have the correct include file directries, library directries, and linked the python32.lib (im using python 32) however the error was that python/C APIs such as PyString_FromString, PyInt_FromLong, PyInt_AsLong are undefined (error …

Member Avatar for Gribouillis
0
160
Member Avatar for giancan

Hi everybody, I completed my scripts and I managed to compile them with py2exe. This script will edit some images and will save the output in a specific subfolder of the program (if the user will install it in the default location it will be something like c:\program files\MyProgram\output The …

Member Avatar for giancan
0
264
Member Avatar for ryan461

I'm trying to get the available disk space on a remote linux host using python. The best way I could think to do this would be to os.popen a df command, and use regex to get the available space from the output. I then need to apply a variable to …

Member Avatar for Gribouillis
0
183
Member Avatar for Blazko89

Hello everyone For my bioinformatic course i have to make script that allow user to open pdb file (its a file containing gathered information about proteins, all files have same structure) and look for number of subunits. To put it even more simple it has to check if there is …

Member Avatar for Blazko89
0
95
Member Avatar for giancan

Hi there, how can I read a file line by line till the 150th line? I mean, I know the [CODE]for line in f:[/CODE] but I want to read only (let's say) 150 lines of the f file. Thanks a lot

Member Avatar for giancan
0
190
Member Avatar for pygame

We are very excited to announce the launch of [URL="http://www.pygamezine.com/"]PyGameZine[/URL]! PyGameZine issue 0 is chock full of articles about pygame, and interviews with people using pygame. It was inspired by the magazines that people used to type code out of into their comodore 64s, or z80 spectrums plugged into their …

0
74
Member Avatar for metalix

Hey guys, I know this will have an easy answer, but I have been awake far too long to see it :P I am doing some coding with classes in python, and it just isn't working. Here is the code: [CODE] from bpy import * from os import * from …

Member Avatar for metalix
0
274
Member Avatar for giancan

Dear all, I wrote 2 scripts and at a certain point of the first I would like to run the second, and when the second is done, to go back to the first and continue with it. How can I do it? I put at the desired point of the …

Member Avatar for giancan
0
186
Member Avatar for RM@Bowdoin

I'm trying to find degrees of separation between any two actors in a movie database. I succeed when I reach my base case, which is 1 degree of separation (i.e. actor is in same movie as another actor) but I use recursion to find all other degrees of separation, and …

Member Avatar for Gribouillis
0
2K
Member Avatar for my_py

I have written almost all of my program, except I am stuck on this certain part. I need to write an averege out to figure all students final grades out as a statistic of the course. Students name and final grade have been appended to an external file(keep in mind …

Member Avatar for my_py
0
171
Member Avatar for as3g

I just completed an assignment, and both scripts function the same ultimatley, but just wanted to know if there were any potential differences, or is it just a matter of style? [CODE] if num % 2 ==0 : new = num //2 num = new print(num) count = count +1 …

Member Avatar for Gribouillis
0
152
Member Avatar for eternalcomplex

Hi, I am using the command in python from a linux system: [CODE=python] import os os.system('grep "^[0-9]" data.txt | wc -l') [/CODE] The output of this is an integer like 115. Can I assign this to a variable somehow? For example: x=os.system('grep "^[0-9]" data.txt | wc -l') DOES NOT WORK. …

Member Avatar for Gribouillis
0
49
Member Avatar for bibidiboo

Hey guys I need some help with making the iframe be dynamic with the webpage. it is in video_page and I cant seem to get around it. here is the code: [code] def video_page(self): return """<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" …

0
65
Member Avatar for C@un5el@r

Hi - I know that this has been somewhat discussed in a couple of threads, but I haven't seen anything with an actual answer. What would the design or pseudocode look like? Write a program that checks HTML files to determine whether the embedded XHTML tags are balanced. The program …

Member Avatar for TrustyTony
0
477
Member Avatar for MakingMoney

I've been asked to write a program that computes the nth Fibonacci number where n is a value input by the user. For example, if n = 6, then the result is 8. This is what I have so far: def main(): print "This program will compute nth Fibonacci" print …

Member Avatar for TrustyTony
0
2K
Member Avatar for sofia85

Hi,I was wondering how to read and write strings in python. I have this code where I'm creating a path, but its a string, and now I want to write to this string. But keep getting this error message [I]AttributeError: 'str' object has no attribute 'write'[/I] I was thinking about …

Member Avatar for Gribouillis
0
235
Member Avatar for Cheese7

Hey, I'm new to Python programming and I've been making a simple rock paper scissors program for practice. I've managed to get it working; it asks the player to enter 'a' for rock, 'b' for scissors or 'c' for paper. If the player entered a, b or c, a number …

Member Avatar for Cheese7
0
152
Member Avatar for draven07

..uhm...hello...i'm new to python programming and I really want to explore more about this... ...i just want to know what is the best compiler I can use for this...

Member Avatar for draven07
0
246
Member Avatar for Shady Baddarni

how can i compare 2 string for bull hit game in python. i wrote the program itself. how can i find how many hits and bulls i have. [CODE]import string import random import re m = input (' Please input the long of the string you want to guess :') …

0
89
Member Avatar for bigredaltoid

Hey guys, I need to print a dictionary from a text file and than print it again with the last two values updated in each row. The text file appears as so: 12345678 Joe Dokes IT 30 95 87654321 Sally Sue ISYS 50 87 34876293 Bo Burnham MATH 60 78 …

Member Avatar for bigredaltoid
0
133
Member Avatar for felix001

I need to write a small bit of code that will print an error if I cannot resolve the name to IP. I see that you can use the "socket.gethostbyaddr" methods but I cant seem to find a simple method/exception for when it does not find an IP address. Also …

Member Avatar for Gribouillis
0
222
Member Avatar for funfullson

Hi every body. I want to make a topographical image from a 2d Aerial photograph. how can I do it in python? Thanks if help me.

Member Avatar for hughesadam_87
0
115

The End.