Recent content by azerty12

  1. A

    Python merge sort not working with fusion function

    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

    Where to find solutions for Introduction to Algorithms exercises

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

    Where to find solutions for 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

    Python 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

    Python UnboundLocalError when setting roulette game inputs in Python

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

    Python 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

    Python 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

    Python 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

    Python UnboundLocalError when setting roulette game inputs 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

    How to compute the solid angle of a cone with half-angle θ

    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

    How to compute the solid angle of a cone with half-angle θ

    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

    Python UnboundLocalError when setting roulette game inputs 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

    Python UnboundLocalError when setting roulette game inputs 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

    Python UnboundLocalError when setting roulette game inputs 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...