473,325 Members | 2,870 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

a few questions.

1. whats the best way to round a result to 4 decimal places?

I tried round, but then read that it only works with exponents of 10.

I'm trying to do it on this piece of code.

time = (distance / 4900)

2. What direction would I go in if I'm getting 5 inputs from the user
and want to make a bar table out of them where a * represents a 100 of
the total number?

For example,

Store 1: * *

Store 2: *

Store 3: * * *

ect,

I already know I'm going to be expecting to use a for loop (0,4) since
there are 5 inputs, but how to get from say, 200 to the output of * *
I'm a little lost.

thx

Oct 31 '07 #1
2 955
Shawn Minisall wrote:
1. whats the best way to round a result to 4 decimal places?

I tried round, but then read that it only works with exponents of 10.

I'm trying to do it on this piece of code.

time = (distance / 4900)

2. What direction would I go in if I'm getting 5 inputs from the user
and want to make a bar table out of them where a * represents a 100 of
the total number?

For example,

Store 1: * *

Store 2: *

Store 3: * * *

ect,

I already know I'm going to be expecting to use a for loop (0,4) since
there are 5 inputs, but how to get from say, 200 to the output of * *
I'm a little lost.

thx
Q:1
>>round(123.45678, 4)
123.4568

Q2:

Something like this works:

stores=[]
for i in xrange(0,5):
x=raw_input("input number for store=%i ?" % i)
stores.append(int(x))

for i in xrange(0,5):
hundreds, remainder=divmod(stores[i], 100)
print "Store: %i %s" % (i+1, hundreds*"*")
-Larry
Oct 31 '07 #2
On Oct 31, 10:10 pm, Larry Bates <larry.ba...@websafe.comwrote:
for i in xrange(0,5):
hundreds, remainder=divmod(stores[i], 100)
print "Store: %i %s" % (i+1, hundreds*"*")
Yes, or since you don't need 'remainder'...

for i in range(5):
hundreds = stores[i] // 100
print "Store: %i %s" % (i + 1, '*' * hundreds)

--
Paul Hankin

Nov 1 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: softwareengineer2006 | last post by:
All Interview Questions And Answers 10000 Interview Questions And Answers(C,C++,JAVA,DOTNET,Oracle,SAP) I have listed over 10000 interview questions asked in interview/placement test papers for...
0
by: connectrajesh | last post by:
INTERVIEWINFO.NET http://www.interviewinfo.net FREE WEB SITE AND SERVICE FOR JOB SEEKERS /FRESH GRADUATES NO ADVERTISEMENT
2
by: freepdfforjobs | last post by:
Full eBook with 4000 C#, JAVA,.NET and SQL Server Interview questions http://www.questpond.com/SampleInterviewQuestionBook.zip Download the JAVA , .NET and SQL Server interview sheet and rate...
4
by: Drew | last post by:
I posted this to the asp.db group, but it doesn't look like there is much activity on there, also I noticed that there are a bunch of posts on here pertaining to database and asp. Sorry for...
8
by: Krypto | last post by:
Hi, I have used Python for a couple of projects last year and I found it extremely useful. I could write two middle size projects in 2-3 months (part time). Right now I am a bit rusty and trying...
0
by: ramu | last post by:
C# Interview Questions and Answers8 http://allinterviewsbooks.blogspot.com/2008/07/c-interview-questions-and-answers8.html C# Interview Questions and Answers7...
1
by: ramu | last post by:
C# Interview Questions and Answers8 http://allinterviewsbooks.blogspot.com/2008/07/c-interview-questions-and-answers8.html C# Interview Questions and Answers7...
0
by: ramu | last post by:
C# Interview Questions and Answers8 http://allinterviewsbooks.blogspot.com/2008/07/c-interview-questions-and-answers8.html C# Interview Questions and Answers7...
0
by: reema | last post by:
EJB Interview Questions http://interviewdoor.com/technical/EJB-Interview-Questions.htm CSS Interview Questions http://interviewdoor.com/technical/CSS-Interview-Questions.htm C Interview Questions...
0
by: reema | last post by:
EJB Interview Questions http://interviewdoor.com/technical/EJB-Interview-Questions.htm CSS Interview Questions http://interviewdoor.com/technical/CSS-Interview-Questions.htm C Interview Questions...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.