What is Python: Definition and 655 Discussions

PYTHON was a Cold War contingency plan of the British Government for the continuity of government in the event of nuclear war.

View More On Wikipedia.org
  1. D

    Python: Converting float into a 'time'

    Hello. Right now I've got two floats that represent times. say 9.5 for 9:30 and 16.5 for 4:30. Basically I want to compare these to the current time, which right now I am doing by saying dt=datetime.now() while 9.5 < float(dt.strftime('%H')) + float(dt.strftime('%M')/60) < 16.5...
  2. D

    How to Compare Times in Python Using the Time Library - Step by Step Guide

    Currently I have a program in which I want to compare times. I have dt = datetime.now() x = dt.time() which gives me the current time in Hours:Minutes:Seconds:MicroSeconds. I also have variables HourStart, MinuteStart, HourEnd,MinuteEnd. Which are the hours and minutes that are the...
  3. D

    Writing out to a directory in python

    Hi, I have a program which is reading in line by line information, saving that, and writing it out to a file. How do I change where the files are created? Also, can I create a folder to write the files out to in my program? The second issue I have is this. right now my program opens the...
  4. R

    Recommend a book on Python Programming

    I'm not a complete newbie to Python but I'm not a pro either (far from it). I played with Python on surface, like doing simple computation in python shell or creating a very simple program (such as finding roots of quadratic equations). Anyway, i would like to explore more into this subject...
  5. M

    Stuck on Continue Statement: Solving a Python Coding Problem

    I Have been using A Byte of Python, and I am now stuck on the Continue Statement. Here is my code. #!/usr/bin/python #Filename: continue1.py while True: s = input('Enter something : ') if s == 'quit': break if len(s) < 3: print('Too Small') continue print('Input is of...
  6. F

    Exploring Python SciPy: Free Libs for GUI, Signal Processing, and More

    I'm going to mess around with some Python and was wondering what free libs I should consider. So far I've got: GUI - Tkinter Scientific (mostly signal processing for me) - SciPy Are these OK? Any opinions? Other libs you like (gaming, sound, hardware control & networking, etc.)
  7. R

    Python text in each grid in a grid field

    Hey iam trying to place some text in each grid in a grid field and also to fill each one with different color can anyone please help me out...
  8. T

    Python Plots Book: Best Examples & Guide

    Hi there, I'm looking for a good book dealing with all the power of python plots (3D plots, basemap-plots, mayavi ...) and with good code examples. Any recommendations? Thanks
  9. D

    Python Programming Basics: IDLE vs Command Line

    I just started learning programming and am a little confused about the difference between IDLE and the "Commands Line." What's the difference?
  10. S

    Learning Python Programming - Advice for Beginners

    I am new to computer programming, but if anyone familiar with Python has any suggestions or resources for a beginner, I would appreciate it. How useful is programming in Python? How does it compare to other programming languages? I've also heard that Python is relatively simple to learn...
  11. J

    Python: How does the return statement work?

    Homework Statement I am trying to write a program in which I have a function that uses the variable x. For example, def function(x): x=x+2 return x function(4) Now I want to print out what x was inside the function. I thought I would just say "print function(4)", but...
  12. W

    MATLAB Compile Python, Matlab and Python

    1) I know that python is an interpreted language. But is there a way to compile to code to make it process faster? 2) Suppose I have a huge array of data. I want to process it. If I were to run the process through python(with numpy and scipy), Matlab, and Mathematica which one would be able...
  13. daniel_i_l

    Python Forking: Why Wait for User Input?

    For some reasons, if I fork a process (or start a thread) in python and let the original program wait for user input, the the forked process doesn't print anything to the screen until the newline character is printed. For example (i used '----' instead of indent): doesn't print any thing to...
  14. G

    Help with Python RK4: Solving Error Plotting 1st Order ODE

    i have been attempting to plot a first order ODE with pyhton's rk4 i can't display the graph and i have been having this error: Traceback (most recent call last): File "C:\Documents and Settings\AP155user38\Desktop\gladys python codes\differential equations and runge-kutta\1ODE.py"...
  15. W

    Learning Python & C++: Is It Easy?

    I am learning Python right now and it is pretty cool. Just out of curiosity, would it be a easy transition to learn C++ after I master Python?
  16. W

    Exploring Computational Physics with Python

    Hello, I have recently become interested in computational physics. I know a good deal of Mathematica. Recently I have heard great things about Python. My questions are: 1) How useful is Python in computation? 2) Would there be a better program to learn instead of Python for computation? Any...
  17. G

    Fixing Vim Macros for Python in .exrc File

    Hi, I am trying set a macro in vim's .exrc file such that when I type # in normal mode, vim will call python3 to run my code. I edited the first line of the .exrc file (which is all i need to do i believe), however when i try to open my .py code in vim I get this message: ubuntu@ubuntu:~$...
  18. M

    Python, RungeKutta and first-order differential equation system.

    [b] Homework Equations The equation is, given to me by lurflurf,: mv' + f(v ) + s(u) = F(t), t > 0, u(0) = U0, v (0) = V0 where v=u' For the record the equation was: mu'' + f(u' ) + s(u) = F(t), t > 0, u(0) = U0, u' (0) = V0 . The Attempt at a Solution def rhs(u, t)...
  19. M

    Python: open dat-files, read data

    Homework Statement I have two programs and neither works. In the first program I don't get any autput from andre(f): f = open("densities.dat", "r") def andre(f): densities = {} for line in f: density = float(line[12:]) name = line[0:10].strip()...
  20. M

    Python, making a float of a list

    I have made a list of data from a file, the file contains numbers and I want to calculate with the numbers. How do I make a float of a list where a[1] is: ['0.00500006128645'], I tried to just use float, but then I got: float() argument must be a string or a number
  21. J

    My Python is not working like I need it to

    This is what I have, and for some reason it won't move...I trust all you smart people could point me in the right direction...thanks from visual import * from visual.graph import * relaxedlength = vector(.60,0,0) # length of spring when it isn't stretched or compressed spring =...
  22. M

    Making an arrey of a zipped list, Python

    How do you make an arrey out of this list? for X, H in zip(xarrey,harrey): print "%.2f %.5f" % (X,H)
  23. M

    Run Python on Windows: A Beginner's Guide

    How do you use Python on Windows? I have Python 2.5.1, but have only tried Python on the school's computers where they use Linux.
  24. M

    Python: How to get my variables out of a function

    Homework Statement The exercise: Make a Python function for computing g(t) = e**(-a * t**2) and gderiv(t) = -2*a*t*g(t) Return the function values of g(t) and gderiv(t). Apply the function to write out a result in the format: g(1, a=0.5)=0.606531, g’(1, a=0.5)=-0.606531 I have made a...
  25. M

    Nasa, Ares and the gratuitous Monty Python joke

    Nasa is facing more problems with it's Shuttle replacement. following Ares-I being too small to lift anything the Ares-V looks like it is too heavy for the road to the launchpad. http://www.flightglobal.com/articles/2008/08/21/314931/nasa-faces-budget-busting-crawlerway-rebuild-for-ares-v.html...
  26. O

    Solve Python Woes: How to Get a Five Digit Number Input in One Try

    python woes: ~/code/python$ cat five.py #!/usr/bin/env python x = input('Enter a five digit number: ') while (not(x < 10000 and x > 99999)): x = input('Five digits please: ') firstDigit = x / 10000 secondDigit = (x / 1000) % 10 thirdDigit = (x / 100) % 10 fourthDigit =...
  27. F

    Creating Hotkeys with GTK and Python (or C/C++)

    Has anyone used GTK and Python (or C/C++) here? Any ideas on how to make keyboard hotkeys? I am using Glade3 to build the GUI. Thanks in advance
  28. R

    Understanding Caching in Python Fibonacci Series

    Hey, I decided to start learning python so I downloaded it yesterday and decided to try and make a simple program to produce the Fibonacci series. I managed to do it using a function similar to that on wikibooks: def fib(n): if n < 2: return n else: return fib(n -...
  29. O

    Python Book Error: Solving a Math Problem with Aliens and Multiple Heads

    In python for the absolute beginner, we have this (page 28): "If an alien has 3 heads, grows 1 more than double his total number of heads, how many heads does the alien have?" My formula is: (3 * 2) + 1 (For example, in this sequence, each sequential number is one more than...
  30. O

    Can you append digits to a variable in c++ or python

    Say you have a variable x, that is of type int. x = 1; I just want to create a while or for loop so that each time it runs it adds another digit to it, such as: 12 123 1234 or 1, 11, 111, 1111, and so on.
  31. S

    Help in Python for Computational Physics

    Hi, I am in a computational physics class and we are programming projectile motion in python. I do not know why I am having such a hard time at this, but I cannot get my programs to work. Homework Statement Calculate the effect of backspin on a fastball. How much does an angular velocity of...
  32. S

    How to Load a .py File in the Python Interactive Shell for Debugging?

    How can I load a .py file in the python interactive shell for debugging?
  33. T

    Programming the error function (erf) in Python

    I'm having very unusual problems posting in the math forum. I am trying to write a program that would calculate phi, the CDF of the standard normal curve, in Python. I tried calculating the erf using a series to do it, as described by Wikipedia. But mine diverges, when it should approach 1...
  34. A

    Project in Python: Cop Chase Simulation

    Hi, I'm planning on doing a college project in the Python programming language. I have only started learning it. The project is a simulation of a Cop Chase. The human player controls the getaway car, while the cops are controlled by the computer using strategy written in the program(something...
  35. N

    Comparing Python and Java: Performance & Standard Libs

    Any one have any opinions on the differences between these two language (and their closeness to C)... chroot posted about python being almost as complete as java interms of standard libs. I attended a presentation which seemed to verify that claim though you have to download some of the added...
  36. C

    Creating and Manipulating Variables in Python for Summation

    I want to write a program like this. It asks for a number, n. It then creates n variables, for example variable_1, variable_2 ... variable_n. Then, after some more input, values are given to these variables. I want to do this because at the end of the program, I want to my program to find the...
  37. C

    BitTorrent implemented in Python.

    After endless searching I have resorted to a post, I cannot seem to find anywhere why BitTorrent was first implemented in python, rather than C, Java etc?
  38. Schrodinger's Dog

    Monty Python's Life of Brian: The Musical - Not The Messiah

    Ok since I know there are a few fans of Monty Python here, I read today after the success of Sir Spamalot, the musical version of the Holy Grail they've decided to do a musical version of the life of Brian, any thoughts?:smile: http://enjoyment.independent.co.uk/theatre/news/article2271652.ece
  39. F

    What language? is python good?

    Im in my last year of high school and for about two years now I've wanted to learn to program, but i havnt really gotten into it. Basically I am going to study electrical engineering in a bit over a year (military service comes first) and I would like to learn a language that is useful for...
  40. mbrmbrg

    Monty Python and the Holy Grail

    I willingly set myself up for scorn and ridicule. I just watched Monty Python and the Holy Grail, and I just don't get it. Yeah, I laughed a bunch of times, and enjoyed the funny bits in every scene, but all in all... Huh?:confused: Was there supposed to be anything pulling this together, or was...
  41. N

    What is the difference between using parentheses and square brackets in Python?

    Hopefully someone (chroot??) wil be able to answer this simple Python question. I am looking at a code written by someone else and there are those two enigmatic statements one after the other: link0=(0,0,0,0) pathlist=[link0] Ok, besides the obvious question of why not initializing...
  42. N

    Loading a file (module) in Python

    I have installed Python in a Windows environment and I want to load files to execute them in Python. I have tried "import testprogram.py" and it does load the program and executes it (all the program does is to print something out on the screen) but then there are error messages...
  43. Cincinnatus

    Solving Differential Equations with Python and Runga-Kutta

    I'm trying to write a program in python to solve a system of differential equations using the 4th order Runga-Kutta method. I would ideally like the program to be able to solve systems of arbitrary size. To do this, I believe I will need to write a function (rk4) that would take as...
  44. W

    Displaying Python on the Internet

    Can someone tell me how you would apply python to a web document. Like add the python code to a geocities.com account? I'd like to know that I can publish Python for all to see :smile:
  45. P

    Learning Python: What Do I Need to Download?

    Hey all, I decided I want to learn Python. Why? Cause I can. But, and I can't find this anywhere, what all do I need to download to start? Obviously I need the core product, but what about IDE's or text editors? I can't find any information as to whether or not i need this, or tips or...
  46. dduardo

    Explore Python with Think CSPy

    Check it out: http://www.ibiblio.org/obp/thinkCSpy/index.htm
  47. M

    Creating Executables in Python: A Guide

    How do you make executables in python?
  48. C

    Can I Create Interactive Applets with Python?

    This guy has made a nice series of demonstrative applets with Java. I was wondering what I'd need with Python to do the same thing.
  49. Ivan Seeking

    Python Tries to Eat Alligator, Explodes

    http://www.foxnews.com/story/0,2933,171358,00.html
  50. E

    Learning Python: Getting Started from Java and C++

    I want to start learning python. Lots of people I know say it's a very good language. Right now I know Java and a little bit of C++, but I'd like to experiment with some other languages, specifically Python. Right now I've got Python 2.4 installed on my PC, now I need to know what to do from...
Back
Top