Re: Python installer hangs in Windows 7
Same problem, Win7, Unchecking "Install launcher for all users" sorted things. Thanks for the advice. -- https://mail.python.org/mailman/listinfo/python-list
Re: Question about floating point
"Frank Millman" wrote in message news:... "Frank Millman" wrote in message news:[email protected]... I know about this gotcha - >>> x = 1.1 + 2.2 >>> x 3.3003 [...] I have enjoyed the discussion, and I have learnt a lot about floating point. Thanks to all. I have just noticed one oddity which I thought worth a mention. from decimal import Decimal as D f"{D('1.1')+D('2.2'):.60f}" '3.3000' '{:.60f}'.format(D('1.1') + D('2.2')) '3.3000' '%.60f' % (D('1.1') + D('2.2')) '3.2998223643160599749535322189331054687500' The first two format methods behave as expected. The old-style '%' operator does not. Frank -- https://mail.python.org/mailman/listinfo/python-list
Re: Question about floating point
On Sat, 01 Sep 2018 13:27:59 +0200, Frank Millman wrote:
from decimal import Decimal as D
f"{D('1.1')+D('2.2'):.60f}"
> '3.3000'
'{:.60f}'.format(D('1.1') + D('2.2'))
> '3.3000'
'%.60f' % (D('1.1') + D('2.2'))
> '3.2998223643160599749535322189331054687500'
> The first two format methods behave as expected. The old-style '%'
> operator does not.
The % operator casts the argument to a (binary) float. The other two
don't need to, because they call Decimal's own format method.
--
Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson
--
https://mail.python.org/mailman/listinfo/python-list
Re: Question about floating point
On Sat, 1 Sep 2018 at 12:31, Frank Millman wrote: > > "Frank Millman" wrote in message news:[email protected]... > > > > I know about this gotcha - > > > > >>> x = 1.1 + 2.2 > > >>> x > > 3.3003 > > > [...] > > I have enjoyed the discussion, and I have learnt a lot about floating point. > Thanks to all. > > I have just noticed one oddity which I thought worth a mention. > > >>> from decimal import Decimal as D > >>> f"{D('1.1')+D('2.2'):.60f}" > '3.3000' > >>> '{:.60f}'.format(D('1.1') + D('2.2')) > '3.3000' > >>> '%.60f' % (D('1.1') + D('2.2')) > '3.2998223643160599749535322189331054687500' > >>> > > The first two format methods behave as expected. The old-style '%' operator > does not. > > Frank Presumably, Decimal has a custom formatting method. The old-style % formatting doesn't support custom per-class formatting, so %.60f converts its argument to float and then prints it. Paul -- https://mail.python.org/mailman/listinfo/python-list
Help Needed : script weird result.
All,
I m trying to run this small script to find the lowest of the given array of
numbers. The script works fine for various combination of inputs but fails in a
weird way for a particular set of inputs, can anyone point the mistake in the
script and the behavior.
Script
x = input ("Enter the numbers separated by space and press ENTER :")
x = x.split(" ")
def checkmin(arr):
lowest = arr[0]
for count in range(0,len(arr),1):
if arr[count] < lowest :
lowest = arr[count]
else :
pass
print (lowest)
return lowest
minimum = checkmin(x)
print ("Lowest : {0}".format (minimum))
Weird output is as below.
== RESTART: C:\Users\mohan\Desktop\temp.py ==
Enter the numbers separated by space and press ENTER :5 90 63 82 59 24
5
5
5
5
5
24
Lowest : 24
Regards
Mohan C
--
https://mail.python.org/mailman/listinfo/python-list
Re: Help Needed : script weird result.
On 01/09/18 18:11, [email protected] wrote: > All, > > I m trying to run this small script to find the lowest of the given array of > numbers. The script works fine for various combination of inputs but fails in > a weird way for a particular set of inputs, can anyone point the mistake in > the script and the behavior. > > Script > > x = input ("Enter the numbers separated by space and press ENTER :") > x = x.split(" ") > > def checkmin(arr): > lowest = arr[0] > for count in range(0,len(arr),1): > if arr[count] < lowest : > lowest = arr[count] > else : > pass > print (lowest) > return lowest > > minimum = checkmin(x) > print ("Lowest : {0}".format (minimum)) > > > Weird output is as below. > > == RESTART: C:\Users\mohan\Desktop\temp.py == > Enter the numbers separated by space and press ENTER :5 90 63 82 59 24 > 5 > 5 > 5 > 5 > 5 > 24 > Lowest : 24 > > Regards > Mohan C > Compare, >>> min(5, 90, 63, 82, 59, 24) 5 >>> min('5', '90', '63', '82', '59', '24') '24' >>> Duncan -- https://mail.python.org/mailman/listinfo/python-list
Re: Help Needed : script weird result.
On Sat, Sep 1, 2018 at 1:26 PM duncan smith wrote: > > On 01/09/18 18:11, [email protected] wrote: > > All, > > > > I m trying to run this small script to find the lowest of the given array > > of numbers. The script works fine for various combination of inputs but > > fails in a weird way for a particular set of inputs, can anyone point the > > mistake in the script and the behavior. > > > > Script > > > > x = input ("Enter the numbers separated by space and press ENTER :") > > x = x.split(" ") > > > > def checkmin(arr): > > lowest = arr[0] > > for count in range(0,len(arr),1): > > if arr[count] < lowest : > > lowest = arr[count] > > else : > > pass > > print (lowest) > > return lowest > > > > minimum = checkmin(x) > > print ("Lowest : {0}".format (minimum)) > > > > > > Weird output is as below. > > > > == RESTART: C:\Users\mohan\Desktop\temp.py > > == > > Enter the numbers separated by space and press ENTER :5 90 63 82 59 24 > > 5 > > 5 > > 5 > > 5 > > 5 > > 24 > > Lowest : 24 > > > > Regards > > Mohan C > > > > > Compare, > > >>> min(5, 90, 63, 82, 59, 24) > 5 > >>> min('5', '90', '63', '82', '59', '24') > '24' > >>> > > Duncan > -- > https://mail.python.org/mailman/listinfo/python-list integers are not strings. Strings collate according to alphanumeric sequence. So the 2 in 24 makes it less than the 5 -- Joel Goldstick http://joelgoldstick.com/blog http://cc-baseballstats.info/stats/birthdays -- https://mail.python.org/mailman/listinfo/python-list
Re: Verifying the integrity/lineage of a file
On Fri, 31 Aug 2018 12:51:58 -0600, Malcolm Greene wrote: > Thanks for the replies! I'm going to investigate the use of > python-gnupg which is a Python wrapper for the GPG command line > utility. This library is based on gpg.py written by Andrew Kuchling. > I'm all ears if f anyone has any alternative recommendations or > python-gnupg tips to share. BTW: Target clients are running under > Windows and Linux. Writing your own crypto software is fraught with peril, and that includes using existing libraries. If you don't expect your system to get serious attention from a competent adversary, then fine, go ahead. No ... not even that. If you're _quite_confident_ that your system will never get serious attention ... go ahead. But if you think your system might someday be attacked by an adversary who will exploit insufficiently unguessable nonces, or accidental nonce re-use, or swap-space images of your executing code, or side channels, or any of the other hundreds of issues that have left the history of cryptography so entertainingly littered with the bodies of brilliant aspirants, . . . then use a much-studied, time-tested product. Don't take my word for it (retired cryptologist), ask any reputable cryptologist. Or ask on the sci.crypt newsgroup; they need some traffic. -- To email me, substitute nowhere->runbox, invalid->com. -- https://mail.python.org/mailman/listinfo/python-list
Re: Help Needed : script weird result.
On 9/1/18 1:11 PM, [email protected] wrote: All, I m trying to run this small script to find the lowest of the given array of numbers. The script works fine for various combination of inputs but fails in a weird way for a particular set of inputs, can anyone point the mistake in the script and the behavior. Script x = input ("Enter the numbers separated by space and press ENTER :") Think about what x is here, and what x.split does. x = x.split(" ") Now think about what x is again, and recall that Python is strongly typed. Dan -- https://mail.python.org/mailman/listinfo/python-list
Re: Help Needed : script weird result.
On Sat, 1 Sep 2018 10:11:59 -0700 (PDT), [email protected] wrote: > All, > > I m trying to run this small script to find the lowest of the given > array of numbers. The script works fine for various combination of > inputs but fails in a weird way for a particular set of inputs, can > anyone point the mistake in the script and the behavior. > > Script > > x = input ("Enter the numbers separated by space and press ENTER :") > x = x.split(" ") > > def checkmin(arr): > lowest = arr[0] > for count in range(0,len(arr),1): > if arr[count] < lowest : > lowest = arr[count] > else : > pass > print (lowest) > return lowest > > minimum = checkmin(x) > print ("Lowest : {0}".format (minimum)) > > > Weird output is as below. > >== RESTART: C:\Users\mohan\Desktop\temp.py == > Enter the numbers separated by space and press ENTER :5 90 63 82 59 24 > 5 > 5 > 5 > 5 > 5 > 24 > Lowest : 24 Assuming this is homework, here's a hint: Instead of "5 90 63 82 59 24", feed it "2 ", or "1 09" or "1 2 3 ." (yes, "."). As a stylistic matter, looping over an array's indices is more cumbersome than looping over the elements of the array ("for x in arr:"), unless you actually need the index for something, which you don't. Also, two of the three arguments you pass to range can be omitted. -- To email me, substitute nowhere->runbox, invalid->com. -- https://mail.python.org/mailman/listinfo/python-list
how to get a value from CSV specific cell (A7) thanks
how to get a value from CSV specific cell (A7) thanks -- https://mail.python.org/mailman/listinfo/python-list
Re: how to get a value from CSV specific cell (A7) thanks
HI, CSV has no cells, but you can use csv module from standard lib https://docs.python.org/3/library/csv.html and you can get 7th data from the first row (as A means the first row) __george__ ezt írta (időpont: 2018. szept. 1., Szo, 20:24): > how to get a value from CSV specific cell (A7) thanks > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list
Re: Help Needed : script weird result.
On Sunday, September 2, 2018 at 1:12:17 AM UTC+8, [email protected] wrote: > All, > > I m trying to run this small script to find the lowest of the given array of > numbers. The script works fine for various combination of inputs but fails in > a weird way for a particular set of inputs, can anyone point the mistake in > the script and the behavior. > > Script > > x = input ("Enter the numbers separated by space and press ENTER :") > x = x.split(" ") > > def checkmin(arr): > lowest = arr[0] > for count in range(0,len(arr),1): > if arr[count] < lowest : > lowest = arr[count] > else : > pass > print (lowest) > return lowest > > minimum = checkmin(x) > print ("Lowest : {0}".format (minimum)) > > > Weird output is as below. > > == RESTART: C:\Users\mohan\Desktop\temp.py == > Enter the numbers separated by space and press ENTER :5 90 63 82 59 24 > 5 > 5 > 5 > 5 > 5 > 24 > Lowest : 24 > > Regards > Mohan C Thanks to Duncan, Joel, Peter and Dan. Now I understood what was wrong with the script and i fixed it, Now my scripts executes as expected and also i understand a concept in type casting. As always this group is awesome and responsive, Thanks again guys. Regards Mohan C -- https://mail.python.org/mailman/listinfo/python-list
