- Upvotes Received
- 1
- Posts with Upvotes
- 1
- Upvoting Members
- 1
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
19 Posted Topics
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: a simpler way, without having to convert i to a string could be: [code=python] name='harry' name2='verderchi' nt=8 #number of times to print for i in range(1,nt+1): print '#%s:%s %s'%(i, name, name2) [/code] the %s is a placeholder for the variables inside the brackets. | |
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: 1.Try writing it out on a peice of paper. The first question is easy if you run through what number you would need. 2.any python book will tell you what != means, and 'if not' is self explanatory. 3. will take some thinking about, but after you get the hang … | |
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: How are you wanting to arrange your x and y values? What you have done is correct if you want to create a list of x's and a list of y's whos values are 1 greater than the corresponding x. Ah I think you want to do it in M-code. … | |
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: What particular part of it are you having trouble with? You cant just post your entire assignment. | |
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: What's the project? The strength of python is its portability. Edit:Just clicked the link, Ignore my post. ![]() | |
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: If you are using windows, I would recommend notepad++ You can set the language so it will highlight your code for you. I believe you can also set it to run the script immediately from the editor without too many headaches: [url]http://users.cse.ucdavis.edu/~cmg/courses/nlp/Software/Windows/npp.html[/url] | |
Re: That's what I would have voted for. Its very easy to play with python on linux | |
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 … |
The End.