15,190 Topics

Member Avatar for
Member Avatar for vnproduktionz

[code] Program to make snowflake! # Local graphics module. Must be in same folder as this # program (or both on Desktop) import ecs10graphics as gr # Math module that comes with Python import math def pointOnCircle(f, r): # f is fraction of the way around # r is radius …

Member Avatar for vegaseat
0
93
Member Avatar for NicholasE

Dear All, I am opening a file called initialisation: [CODE]try: initFile = open("initialisation.dat", "r") except IOError: print ("Initialisation file cannot be openned for reading")[/CODE] I would like to read the contents of this file and then print them on several other files i.e. file1, file2, file3, file4, etc. i am …

Member Avatar for Gribouillis
0
122
Member Avatar for lenfranc

I am a newbie just getting started with Python. I have trouble understanding the statement "The __init__.py files are required to make Python treat the directories as containing packages; this is done to prevent directories with a common name, such as string, from unintentionally hiding valid modules that occur later …

Member Avatar for lenfranc
0
155
Member Avatar for Aiban

Hello I wondered if anyone had an idea on a piece of code that could tell me the available free disk space. There is a trick here, otherwise this easy question wouldn't be here. I need the free disk space to read off where the program is being run, and …

Member Avatar for Stefano Mtangoo
0
286
Member Avatar for truekid

-------------------------------------------------------------------------------- So i just realized after checking my emial that i have a python hw for my comp sci class due tom night at 12am . I read the hw and i am a bit lost. I will be starting it tonight once i get out of work. The task …

Member Avatar for sneekula
0
101
Member Avatar for gangster88

i am a bit stuck on this, i need to call the first 2 functions for the output in the 3rd one. The user has to should be able to continue until they want to stop converting and they should be asked on which way the conversion is to be …

Member Avatar for sneekula
0
589
Member Avatar for Musafir

[CODE]def main1(f): return (f - 32) * 5.0 / 9.0 def main2(c): return 9.0 / 5.0 * c + 32[/CODE] the two function above convert fahrenheit and celsius I have to write a third function which calls the two functions above and allows the user to input to convert between …

Member Avatar for sneekula
0
390
Member Avatar for Tech B

I want to read two points in a picture. Most pixel values will be (0,0,0). I don't know how to take the flatted data and separate it into x,y coordinates. I use the Image library and VideoCaputre.

Member Avatar for fallopiano
0
520
Member Avatar for Prahaai

Good day. I would need an advice about sys.stdout and sys.stderr. I use Python 2.6, on Windows XP SP3, but i think the question is the same for UNIX/ MAC computers. I tried all possible combinations before posting this message, so ANY advice would be great. I work with "subprocess" …

Member Avatar for Gribouillis
0
345
Member Avatar for Garee

Hey guys I have a wee problem I need some help with. How would I read in lines of text one at a time, keeping track of the line numbers, only stopping when a line is read that contains only a single full-stop. Example: It is a briskly blowing wind …

Member Avatar for masterofpuppets
0
102
Member Avatar for biotic.computer

Hi everybody :) i opened a freshly new blog about python and simulation in bioinformatics and i started by programming a DNA Replication,Transcription andTranslation simulator with very simple python commands so is there any improvement to the code source? the Vpython is needed for graphs the blog:[URL="http://bioticcomputer.blogspot.com/"]http://bioticcomputer.blogspot.com/[/URL] the code source:[URL="http://www.slingfile.com/file/ENAI9lK4FM"]http://www.slingfile.com/file/ENAI9lK4FM[/URL] …

Member Avatar for Gribouillis
0
108
Member Avatar for marcux

Hi all! I want to make a subclass of dict and I have read about subclassing and the super method. The problem that I do not get is how I override the following method: [CODE]dict[key] = value[/CODE] This creates a new key with the specified value. I want to override …

Member Avatar for Gribouillis
0
187
Member Avatar for sneekula

I was trying to create a 3x3 list of lists, and came up with this surprising behaviour: [code]# creating a 2D list with an overloaded * operator mlist3 = [[0]*3]*3 print mlist3 # [[0, 0, 0], [0, 0, 0], [0, 0, 0]] mlist3[0][0] = 1 print mlist3 # [[1, 0, …

Member Avatar for Mathhax0r
0
1K
Member Avatar for Musafir

i have to write a program that simulates the flipping of a coin. 1. the function should ask the user how many times the coin should be flipped 2. the program should display the poportion of times that the head and tails appeared. (for example if the user enters 10 …

Member Avatar for vegaseat
0
138
Member Avatar for SoulMazer

Okay, so I am writing a media player and I would like to be able to control the entire thing without the use of a GUI. So...are there any libraries or anything that would allow me to collect keystrokes on any OS (not just Windows)? Thanks in advance.

Member Avatar for Tech B
0
231
Member Avatar for aleezy

For my final project our group is suppose to simulate a game of table tennis this is what we have so far at the bottom. We followed the raquetball game setup for the code but we werent sure how to change this so that when a player scores it doesnt …

Member Avatar for masterofpuppets
0
2K
Member Avatar for lewashby

Please look at the program below as well as my understanding of how it flows and correct me if I'M wrong. Thanks The first line in main - [COLOR="Red"]crit = Critter("Poochie")[/COLOR], creates an object with the string "Poochie" and autmoatically calls [COLOR="Red"]__init__[/COLOR], printing "A new critter has been born!" [COLOR="Red"]__init__ …

Member Avatar for lewashby
0
172
Member Avatar for nizbit

I have a dictionary that I would like to load from a file into a class variable. The dictionary holds configuration data. I would have different files for different configurations. I was wondering if there is a way to do this? I found pickle but that saves an existing instance …

Member Avatar for winmic
0
89
Member Avatar for saikeraku

I'm just trying to create a program that will remove all the trailing whitespace in a text file. (Like all the whitespace after each sentence for the whole text file.) [CODE] n = raw_input("Enter name of file: ") f = file(n, "r") fr = f.read() for fr in f: fr …

Member Avatar for woooee
0
128
Member Avatar for J0kerman

So i want to define a variable with the index of a current step, and then print that variable. For example I have a loop with 10 steps, and i want to define 10 variable: x1, x2, x3....x10 and then print them out: x1=something, x2=something, ......, x10=something.Does anyone know how …

Member Avatar for J0kerman
0
23K
Member Avatar for gangster88

how could i double a number when clicked on in the graphics window?... this is for graphics.py and a line separating the two sides in the graphics window and on each click on either side it must go up by 2 until 12? i can only think of using a …

Member Avatar for jaison2
0
151
Member Avatar for sneek

Hi, may anybody tell me why there is a init AND a new-method? Why not using one constructor-method like we have to use in java and other OO-lanuages?? Would be nice if somebody can give me an idea about that. Thanks a lot Jonny

Member Avatar for sneek
0
185
Member Avatar for deonbannes09

I'm suppose to make a program that uses a Card class to simulate the random dealing of a single Blackjack hand by a Blackjack dealer who follows the standard rules. As it simulates the the single hand, it should randomly draw a new card (by randomly choosing a suit and …

0
37
Member Avatar for lewashby

I have to prgrams and thus, two question to ask. In the following program how does the line [COLOR="Red"]status = staticmethod(status)[/COLOR] do anything? My python programming book somehow connects it to the line [COLOR="Red"]Critter.total +=[/COLOR] 1 but I don't see how? Please explain. [CODE]# Classy Critter # Demonstrates class attributes …

Member Avatar for vegaseat
0
191
Member Avatar for ffs82defxp

i recently found that variables set in a function cannot be used in another function. so to make variables 'universal' i have to make them global variables? and you do that buy stating them global, like this? [CODE]global [VARIABLE NAME]=[VALUE][/CODE] i have a feeling there is more to it.

Member Avatar for vegaseat
0
378
Member Avatar for ffs82defxp

is there a command or fuction in python that deals with email? like: [CODE]email(ibmceo@ibm.com, 'Hello, my name is Bill. How are you doing at IBM?', email.cc(),attach("C:\123321.txt"))[/CODE] :D

Member Avatar for vegaseat
0
83
Member Avatar for jaison2

I need help with the function but i have no clue how to?.. the function should generate a random number between 1 and 100 and then allow the user to guess the number. After each guess it should display if the guess is too high or low and if they …

Member Avatar for snippsat
0
206
Member Avatar for NicholasE

Dear members, I need to write a small loop to generate the following: 0 0 0 0 .... 0 1 1 1 .... 1 2 2 .... 2 3 .... 3 4 : 299 I think it needs a double loop but since i am still beginner in python i …

Member Avatar for NicholasE
0
109
Member Avatar for ffs82defxp

simple simple grrr [CODE]import math import time while 1: r = input("Enter Circle Radius --> ") circ = (pow(r,2)) * 3.14 print '' print 'The circumferance of a circle with a radius of ',r,'is',circ,'.' print '' time.sleep(2) print '' print '' print '' print "Loop Start or Exit? 'l' or …

Member Avatar for masterofpuppets
0
116
Member Avatar for SoulMazer

So, I have a script that needs to "clean up" when it is exited: it needs to clear a special logging file and other small things that affect the next startup of the script. The script has a GUI written in Tkinter, if that is relevant at all. Is there …

Member Avatar for SoulMazer
0
101

The End.