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

Username:   Password: 
 RegisterRegister   
 Please Be Gentle With Ur Help Older Godz
Index -> Programming, Python -> Python Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
ChamerZ




PostPosted: Fri Dec 31, 2010 5:04 pm   Post subject: Please Be Gentle With Ur Help Older Godz

Hello, Im new to Python and programming in general and i have been going slowly thru the 'how to think like a computer scientist python edition' slowly. I reached this exercise which wants you to calculate the sum of the squares of each digit in an integer. Is there a built in function for doing this in python or is it doable somehow using the knowledge I already got up until this point??? If so ... don't tell me ill figure it out somehow. anywayz thanks
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Fri Dec 31, 2010 5:12 pm   Post subject: RE:Please Be Gentle With Ur Help Older Godz

Is there a build in function that does sum of squares? No. But there are methods for raising an integer to any power (including 2) and methods for collecting a bunch of numbers together (such as in a sum).

I would also recommend checking out http://learnpythonthehardway.org/
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
McKenzie




PostPosted: Fri Dec 31, 2010 5:12 pm   Post subject: Re: Please Be Gentle With Ur Help Older Godz

ChamerZ @ Fri Dec 31, 2010 5:04 pm wrote:
is it doable somehow using the knowledge I already got up until this point???

This is sorta hard to answer without somehow figuring out the knowledge you already have. I suggest posting what code or ideas you have already.
ChamerZ




PostPosted: Fri Dec 31, 2010 5:30 pm   Post subject: Re: Please Be Gentle With Ur Help Older Godz

McKenzie @ Fri Dec 31, 2010 5:12 pm wrote:
ChamerZ @ Fri Dec 31, 2010 5:04 pm wrote:
is it doable somehow using the knowledge I already got up until this point???

This is sorta hard to answer without somehow figuring out the knowledge you already have. I suggest posting what code or ideas you have already.


i cant post it right now because its on the other computer .. but basic mundane stuff (i basically just discovered how to do the while loop). So there's no built in function? ok cool this is gonna be fun
ChamerZ




PostPosted: Fri Dec 31, 2010 5:33 pm   Post subject: Re: RE:Please Be Gentle With Ur Help Older Godz

Tony @ Fri Dec 31, 2010 5:12 pm wrote:
Is there a build in function that does sum of squares? No. But there are methods for raising an integer to any power (including 2) and methods for collecting a bunch of numbers together (such as in a sum).

I would also recommend checking out http://learnpythonthehardway.org/



yo peace for the book, its like exactly what ive been lookin for these past few days. props
Display posts from previous:   
   Index -> Programming, Python -> Python Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: