[Tutor] help

Alan Gauld alan.gauld at btinternet.com
Wed Mar 9 00:14:11 CET 2011

"Vickram" <vick1975 at intnet.mu> wrote

> I need help in translating a C++ code into python..
> Can you help please?
> The python result is wrong because I may have misread the C++ code

The C++ code is really just C code, there is virtualy no C++ stuff 
But that aside your translation is pretty faithful (too faithful with 
those float() conversions).

When you say it is "wrong" what exactly do you mean?
You get different values as output? By how much?

It looks like you need to do a detailed step by step walk through
of the code and see if you have missed an operator or polarity
or maybe have an off-by-one error in a loop.


Alan Gauld
Author of the Learn to Program web site

More information about the Tutor mailing list