Got Homework?
Connect with other students for help. It's a free community.
Here's the question you clicked on:
 0 viewing
minimallinux
Group Title
I cant find the definition for divisor anywhere, for this
divisor = 2
for num in range(0, 10, 2):
 one year ago
 one year ago
minimallinux Group Title
I cant find the definition for divisor anywhere, for this divisor = 2 for num in range(0, 10, 2):
 one year ago
 one year ago

This Question is Closed

bwCA Group TitleBest ResponseYou've already chosen the best response.0
you have defined divisor as 2 you have assigned 2 to divisor divisor in this instance is a 'variable' pointing to the integer 2 http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html#otherlanguageshavevariables
 one year ago

goformit100 Group TitleBest ResponseYou've already chosen the best response.0
POST THE QUESTION IN THE MATHEMATICS SECTION
 one year ago

minimallinux Group TitleBest ResponseYou've already chosen the best response.0
Actually what I meant was 'what does divisor mean in the context of the whole loop, which finishes with print(num / divisor)
 one year ago

bwCA Group TitleBest ResponseYou've already chosen the best response.0
the shell is a great place to try things out http://dpaste.com/810583/
 one year ago

minimallinux Group TitleBest ResponseYou've already chosen the best response.0
That's what I meant, knowing that divisor is simply the number by which the original numbers are divided by, of course its obvious in retrospect !
 one year ago

minimallinux Group TitleBest ResponseYou've already chosen the best response.0
Actually still not entirely sure about this one
 one year ago

minimallinux Group TitleBest ResponseYou've already chosen the best response.0
Is ' num in range(0,10,2') refer to range 0 to 10 but every alternate number, then that divide by the divisor, which is 2 ?
 one year ago

bwCA Group TitleBest ResponseYou've already chosen the best response.0
pretty much http://docs.python.org/tutorial/controlflow.html#forstatements http://docs.python.org/library/functions.html#range http://docs.python.org/reference/compound_stmts.html#theforstatement
 one year ago

minimallinux Group TitleBest ResponseYou've already chosen the best response.0
Thanks
 one year ago

rsmith6559 Group TitleBest ResponseYou've already chosen the best response.0
No. When range is called with three arguments, the. first is start value, the second is end value and the third is the step. num in range( 0 , 10, 2 ) will give 0, 2, 4, 6, 8
 one year ago

minimallinux Group TitleBest ResponseYou've already chosen the best response.0
So the last value is step or stride
 one year ago

rsmith6559 Group TitleBest ResponseYou've already chosen the best response.0
When called with three arguments, yes.
 one year ago
See more questions >>>
Your question is ready. Sign up for free to start getting answers.
spraguer
(Moderator)
5
→ View Detailed Profile
is replying to Can someone tell me what button the professor is hitting...
23
 Teamwork 19 Teammate
 Problem Solving 19 Hero
 Engagement 19 Mad Hatter
 You have blocked this person.
 ✔ You're a fan Checking fan status...
Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.