Desperately seeking programmer who knows python and Visual basic!

Paul Rubin phr-n2002b at NOSPAMnightsong.com
Wed Jan 15 02:51:05 CET 2003


hockeymike at houston.rr.com (hockeymike) writes:
> Could someone please translate the following statement from Python to
> its equivalent in Visual Basic please??

Um, comp.lang.python is sort of the wrong newsgroup, since most Python
users won't know VB.  I don't know VB but remember some regular
old-fashioned BASIC.  I assume you meant

    points = 0
    for level in range(1,100):
       diff = int(level + 300 * math.pow(2, float(level)/7) )
       points += diff
       str = "Level %d = %d" % (level + 1, points / 4)
       print str
 
(Python knows where the loop begins and ends from the indentation, so
the whitespace is significant).  In BASIC this would be

    points = 0
    for level = 1 to 100
      diff = level + 300 * 2^(level / 7)
      points = points + diff
      print "Level"; level+1; points / 4
    next level

Note that the "diff" formula in Python is messier than it needs to be.
Whoever wrote the Python code could have written it roughly the same
way as the Basic statement shown.




More information about the Python-list mailing list