Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Can Some1 Convert Python to Turing?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Guest




PostPosted: Mon May 22, 2006 10:00 pm   Post subject: Can Some1 Convert Python to Turing?

I got this piece of Python code, can someone convert it to Turing for me? I tried but the results do not match.

PYTHON:
code:

points = 0
for level in range(1,100):
    diff = int(level + 300 * pow(2, float(level)/7) )
    points += diff
    str = "Level %d = %d" % (level + 1, points / 4)
    print str


[/code]
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Mon May 22, 2006 10:34 pm   Post subject: (No subject)

I don't know Python, but would it be something like
code:

var points:int := 0

for level: 1 .. 100
   points += floor(level + 300 * 2 ** (level / 7))
   put "Level ", level + 1, " = ", points / 4
end for
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Guest




PostPosted: Mon May 22, 2006 10:36 pm   Post subject: (No subject)

Sweet thanks. That's what I needed =)
MysticVegeta




PostPosted: Mon May 22, 2006 10:40 pm   Post subject: (No subject)

Isn't "int", "round"? instead of "floor"?
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: