473,287 Members | 1,659 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,287 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 954
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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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...

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.