Got Homework?
Connect with other students for help. It's a free community.
Here's the question you clicked on:
 0 viewing
In exercise 1.8 how do you convert a fraction into a decimal using a for loop? I was somewhat able to do it by getting the indexes without using a loop, but there has to be a better way!
 one year ago
 one year ago
In exercise 1.8 how do you convert a fraction into a decimal using a for loop? I was somewhat able to do it by getting the indexes without using a loop, but there has to be a better way!
 one year ago
 one year ago

This Question is Closed

KLEEDSBest ResponseYou've already chosen the best response.1
Step 1. Go to the MIT OCW course page for 6.189 here: http://ocw.mit.edu/courses/electricalengineeringandcomputerscience/6189agentleintroductiontoprogrammingusingpythonjanuaryiap2011/ Step 2. Go into the PDF for Written Excercises Step 3. Write a loop to count from 2 to 10 for the number on the bottom of the fraction for n in range (2,11): Step 4: In the body of the loop, print the fraction in decimal form print 1.0/n That should do it. To make it more explicit what is happening, it could be coded like this too: print 1.0/float(n) To actually do the division doesn't require us to write a for loop, fortunately, since python knows how to do that without our involvement!
 one year ago

Brandon7Best ResponseYou've already chosen the best response.0
Thank you so much!!!!! I really appreciate it!!
 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.