Recent content by azerty12

  1. A

    Help Me Debug My Merge Sort Algorithm

    Hi I'm trying to program a merge sort algorithm on python but it just doesn't work! I first implemented a fusion algorithm which takes as arguments a list A divided into 2 sorted sub lists A[p..q] and A[q+1..r]. Fusion then returns the list A completely sorted. This program seems to work...
  2. A

    Finding Solutions to "Introduction to Algorithms" Exercises

    I think I'm gone pay myself snacks then ! ;)
  3. A

    Finding Solutions to "Introduction to Algorithms" Exercises

    Hi, I'm studying algorithmic on "Introduction to algorithms" by Cormen, Rivest, Stein and Leiserson. This book is very well done and proposes more than a thousand exercises, but the point is these exercises are not corrected. It enables us to really search them, but it is frustrating when you...
  4. A

    Why Does My Python Matrix Multiplication Code Raise a TypeError?

    sorry for the delay I had no internet access for a while thank you for your help jhae2.718, it looks like this was the problem indeed!
  5. A

    Troubleshooting a Roulette Game Program in Python

    Absolutely Mark, you got it! Thanks a lot and thanks to jihae and radou
  6. A

    Why Does My Python Matrix Multiplication Code Raise a TypeError?

    A and B are nested lists indeed. They look like A=[[1,2,3],[2,3,4],[2,2,3]] for instance. But what amazes me is that when I try to work with A[0][0] in the python shell, then there is absolutely no problem whereas with my program (with IDLE) an error is raised...
  7. A

    Why Does My Python Matrix Multiplication Code Raise a TypeError?

    I tried to and actually each of the objects I try to assign exist...
  8. A

    Why Does My Python Matrix Multiplication Code Raise a TypeError?

    Hi all! I'm learning programming on Python. Currently, I'm trying to implement a recursive algorithm using a divide and conquer method to compute a product of matrices. Yet an error occurs when I try to assign an element in a list (representing a matrix) I can't understand where the problem...
  9. A

    Troubleshooting a Roulette Game Program in Python

    Yes I did notice the line you added. But it still raises the same kind of exception. Do you mean that instead of printing things like "wrong number"... I should return these?
  10. A

    Compute Solid Angle of Cone: θ | Hi Everyone

    Thank you emgram769: In fact that's almost what I tried to do but I took the second integral with -theta instead of 0 (and we should take 0 because phi is integrated over 2Pi)
  11. A

    Compute Solid Angle of Cone: θ | Hi Everyone

    Hi everyone I'd like to compute the solide angle defined by a cone whose angle θ is known. I tried with the definition but I probably mistook since it lead me to compute an integral worth...0. I then tried with a rule of three, but the result I get is clearly wrong too. Could you...
  12. A

    Troubleshooting a Roulette Game Program in Python

    I'm afraid the first way doesn't work, it generates the following exception: UnboundLocalError: local variable 'col' referenced before assignment About your second suggestion: Could you tell me how to exit the function please? (I just begging in programming)
  13. A

    Troubleshooting a Roulette Game Program in Python

    Hi Radou Here's my program (edited with IDLE) The problem occurs when I execute Roulette() on python's shell and when I choose 'No' when he asks me whether I want to play I didn't put much comments on my program, so if there is something you don't understand, just ask. Since I can't...
  14. A

    Troubleshooting a Roulette Game Program in Python

    Hi guys I'm trying to program a Roulette game on Python My programs asks for inputs and I gave names to these inputs. The point is, since I didn't assign these names before, the following error occurs: UnboundLocalError: local variable 'color' referenced before assignment I tried to get...
Back
Top