- Upvotes Received
- 1
- Posts with Upvotes
- 1
- Upvoting Members
- 1
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
Hi, I'm wanting my program to loop and create different files outputting at different stages in a while loop, I just can't work out how to make it happen! here's a stupid example [code=python] while (a<10): a = a+1 if (a=4) or (a=6): output = open('output'+a, 'w') #something like this? … |
|
Hi, I was wondering what libraries there are out there to do some simple sound generation. For example sine waves, square waves etc.. I'm on Linux, so no Microsoft stuff please. |
|
Hi, I want to create a program that will synchronise a folder on my laptop(running OS X) and a folder on a remote server(running Linux). For example, the program is contained in a subfolder on my laptop, when I run it, it ssh's to the remote folder and loops through … |
|
Re:
Trying to make a program that displays "Harry Verderchi" 7 times using the for-loop. With the number preceding the name like: #2: Harry .... name = "Harry" name2 = "Verderchi" for i in range(8): print "#" + "i" + ": " + name + " " + name2 |
|
Hi, I've got some c++ code(which i don't have much experience in). I'm trying to write the same code again in python but i'm not having much luck. The c++ code creates an array of x,y co-ordinates: [code=c++] for (double ix = 0; ix < nlat; ix++) { for (double … |
|
Re:
All questions involve this portion of a program: [CODE] if (y>x and y<z)or(y<x and y>z): print("You have entered Condition 1") elif not(x!=y and y!=z): print ("You have entered Condition 2") else: print ("You have entered Condition 3")[/CODE] 1. If x = 10 and y = 10, what is the value … |
|
Hi, I have 2 columns of data, separated by a space, which I am trying to import into 2 variables as a tuple. Each column as a variable. I know the program would involve something using line.split() or line.strip() but I can't figure out how I would do it. Also … |
|
Hi, I have been writing a program that simulates the behaviour of a system of hard disks using the monte carlo method. I ran the program upto around 2 million steps and it's really slow(takes around 3 1/2 to 4 hours). I first wrote it in vpython as I'm a … |
|
Re:
I want to store two variables in an array or list in a loop to collect all my x an y, something like the append function in python, can anyone help me. |
|
Hi. I've read the documentation but I can't quite work out how i create an object and give it attributes. I'm trying to create a disk object that has attributes disk.x and disk.y which i can then identify with a line, [code=python] disk.id = (x,y) [/code] |
|
Re:
Okay I don't get this problem at all: [code=python]import random def chance(number): number = input for each in xrange(number): n = random.randrange(100)+1 return n def extreme(x): z = x + 5 y = z - 3 return z, y #main repeat = 0 while repeat != 2: x = input("Enter … |
|
Hi I'm wondering how I would go about creating a program that will input data from about 1,000 files containing data such as this: [code] 2.825 1.00697992588 2.875 0.952989176901 2.925 0.91428970229 2.975 0.890110513425 3.025 0.879731596138 3.075 0.959217137445 3.125 1.07391392796 3.175 1.04874407027 3.225 0.857693793906 [/code] I'm wanting to generate an average … |
|
Re:
Does anybody know a good way place to find developers for an open source project? |
|
Hi, I'm trying to print two arrays to a file, these are pretty large. However I want to print them as two lists. This is an example of what my output is now: [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. … |
|
Is there an easy way of doing this? for example my list is: [code=python] nlat=10 mylist = [] for x in range(0,nlat): for y in range(0,nlat): disk=sphere(pos=(x*s,y*s), radius = r, color=(0,1,9)) mylist.append(disk) [/code] or is it impossible to place objects, such as a sphere from vpython into a numpy array?, … |
|
Hi, I'm making a program in VPython to simulate the motion of particles. It's fairly simple in theory but I'm having some problems with my lists of particles. What I'm trying to do is make sure that the particles do not overlap, and regenerate a position if they do overlap. … |
|
Re:
I start learning about python, so i read the tutorial: they show this: >>> x = int(raw_input("Please enter an integer: ")) Please enter an integer: 42 >>> if x < 0: ... x = 0 ... print 'Negative changed to zero' ... elif x == 0: ... print 'Zero' ... … |
|
Re:
For the second year running Python has been selected as the Language of the Year by Linux users: [code] Linux Users' Programming Languages of the Year 2008 PHP 115 13.36% Perl 72 8.36% Python 226 26.25% Ruby 46 5.34% C 114 13.24% C++ 129 14.98% Java 106 12.31% Lisp 9 … |
|
Hi, I'm trying to create a 2-Dimensional box in vpython and fill it with circles placed in random positions but the circles cannot overlap. This is how far I have got, but I can't work out how to make the positions not overlap. I'm sure most of what I've done … |