Re: Python running issues

2019-04-19 Thread dieter
Kiranpreet Kaur writes: > I am trying to run python from command prompt. However, cannot get past the > error: “ImportError: no module named site” Your Python installation is severely broken. I cannot tell you why. I would try a reinstallation (and see whether the problem disappears). If the pr

Re: Questions on Instance methods

2019-04-19 Thread dieter
Arup Rakshit writes: >>When an instance method object is created by retrieving a class method >> object from a class or instance, its __self__ attribute is the class itself, >> and its __func__ attribute is the function object underlying the class >> method. > > Here I have 2 questions: >

Re: Function to determine list max without itertools

2019-04-19 Thread Michael Torrie
On 04/19/2019 04:01 AM, Sayth Renshaw wrote: > def max_try(listarg): > myMax = listarg[0] > try: > for item in listarg: > if item > myMax: > myMax = item > except TypeError: > print(f'Only numbers are supported, this entry "{item}" was not') >

Re: Function to determine list max without itertools

2019-04-19 Thread Rob Gaddi
On 4/19/19 5:34 PM, MRAB wrote: [snip] How would you avoid comparing the initial max with list[0]? By slicing the list? By using 'iter' and 'next'? Do you expect that doing either of those to avoid a single comparison would make it faster? Is a comparison very expensive? You could, of cour

Re: Function to determine list max without itertools

2019-04-19 Thread MRAB
On 2019-04-20 00:24, DL Neil wrote: On 20/04/19 4:41 AM, Rob Gaddi wrote: On 4/19/19 12:23 AM, Sayth Renshaw wrote: On Friday, 19 April 2019 17:01:33 UTC+10, Sayth Renshaw  wrote: Set the first item in the list as the current largest. Compare each subsequent integer to the first.

Re: Function to determine list max without itertools

2019-04-19 Thread Cameron Simpson
On 19Apr2019 05:38, Dan Sommers <2qdxy4rzwzuui...@potatochowder.com> wrote: On 4/19/19 4:01 AM, Sayth Renshaw wrote: Now, what happens when the code is tested with various (different) sets of test-data? (remember the last question from my previous msg!?) It fails on any list entry that isn'

Re: Function to determine list max without itertools

2019-04-19 Thread DL Neil
On 20/04/19 4:41 AM, Rob Gaddi wrote: On 4/19/19 12:23 AM, Sayth Renshaw wrote: On Friday, 19 April 2019 17:01:33 UTC+10, Sayth Renshaw  wrote: Set the first item in the list as the current largest. Compare each subsequent integer to the first. if this element is large

Re: Python running issues

2019-04-19 Thread Bob Gailer
please copy everything from the command you entered through the end of the error message. Then paste that into a reply email. Also let us know what your operating system is. Be sure to reply all so a copy goes to the list. Bob Gailer On Apr 19, 2019 6:56 PM, "Kiranpreet Kaur" wrote: Hello, I

Python running issues

2019-04-19 Thread Kiranpreet Kaur
Hello, I am trying to run python from command prompt. However, cannot get past the error: “ImportError: no module named site”, whenever I try to run Python from the terminal. Can you help me fix that? I spent a couple hours on searching a fix for this issue on Google and nothing seems to work. I

Re: Enhanced input dialog

2019-04-19 Thread Chris Angelico
On Sat, Apr 20, 2019 at 7:16 AM wrote: > > Running Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 > 32 bit (Intel)] on win32. > Under Win7 using Pyscripter 3.6.0.0 x86 > Somehow integer1 = input( "Enter first integer:\n" ) # read string > when executed presents a nice input

Enhanced input dialog

2019-04-19 Thread srfpala
Running Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit (Intel)] on win32. Under Win7 using Pyscripter 3.6.0.0 x86 Somehow integer1 = input( "Enter first integer:\n" ) # read string when executed presents a nice input dialog box instead of a command line prompt.

Reg : Data Analysis using python

2019-04-19 Thread Sushanth
Hi team, Election Analytics mock view -- *Regards* *Sushanth* *ph : 91-9444583307* -- https://mail.python.org/mailman/listinfo/python-list

Re:

2019-04-19 Thread Shakti Kumar
On Fri, 19 Apr 2019 at 11:19 PM Tamara Berger wrote: > Hi Shaki, > > Thanks for your reply. I tried your code, but it didn't work. Here is the > section of code and your addition: > >if ((monthly_salary*t)*compound_int) print('It is not possible to save for the downpayment in 36 months.

Re:

2019-04-19 Thread Shakti Kumar
On Fri, 19 Apr 2019 at 9:33 PM Tamara Berger wrote: > Hi Python-List, > > What code can I use to break out of a program completely, and not just out > of a loop? import sys sys.exit() Should do your work. > I wrote code with 3 conditions for saving for a downpayment. The > first addresses ca

Re: Function to determine list max without itertools

2019-04-19 Thread Rob Gaddi
On 4/19/19 12:23 AM, Sayth Renshaw wrote: On Friday, 19 April 2019 17:01:33 UTC+10, Sayth Renshaw wrote: Set the first item in the list as the current largest. Compare each subsequent integer to the first. if this element is larger, set integer. def maxitwo(listarg):

RE: break out of a program

2019-04-19 Thread David Raymond
The normal way of saying you want to exit the whole program is with sys.exit() https://docs.python.org/3.7/library/sys.html#sys.exit You can optionally give it the return code/exit status you want the interpreter to give to the OS when it exits. -Original Message- From: Python-list [ma

Re: (no subject)

2019-04-19 Thread Luuk
On 19-4-2019 16:37, Tamara Berger wrote: Hi Python-List, What code can I use to break out of a program completely, and not just out of a loop? I wrote code with 3 conditions for saving for a downpayment. The first addresses cases that don't meet the minimum condition; i.e., enough money to save

Re: (no subject)

2019-04-19 Thread Luuk
On 19-4-2019 16:37, Tamara Berger wrote: Hi Python-List, What code can I use to break out of a program completely, and not just out of a loop? I wrote code with 3 conditions for saving for a downpayment. The first addresses cases that don't meet the minimum condition; i.e., enough money to save

[no subject]

2019-04-19 Thread Tamara Berger
Hi Python-List, What code can I use to break out of a program completely, and not just out of a loop? I wrote code with 3 conditions for saving for a downpayment. The first addresses cases that don't meet the minimum condition; i.e., enough money to save for a downpayment within the allotted time.

Questions on Instance methods

2019-04-19 Thread Arup Rakshit
>When an instance method object is created by retrieving a class method > object from a class or instance, its __self__ attribute is the class itself, > and its __func__ attribute is the function object underlying the class method. Here I have 2 questions: 1. How do you create an instance m

Re: Question regarding the __kwdefaults__ output being None

2019-04-19 Thread Arup Rakshit
Hi Peter, Thanks for explaining it. Beautiful. Thanks, Arup Rakshit a...@zeit.io > On 19-Apr-2019, at 5:53 PM, Peter Otten <__pete...@web.de> wrote: > > Arup Rakshit wrote: > >> I have a very basic function. >> >> def greet(name, msg = "Good morning!"): >> """ >> This function greets

Re: Function to determine list max without itertools

2019-04-19 Thread Ben Bacarisse
Sayth Renshaw writes: >> Now, what happens when the code is tested with various (different) sets >> of test-data? >> (remember the last question from my previous msg!?) >> > It fails on any list entry that isn't a float or an int, giving a TypeError. > >> Once you are happy with the various tes

Re: Question regarding the __kwdefaults__ output being None

2019-04-19 Thread Peter Otten
Arup Rakshit wrote: > I have a very basic function. > > def greet(name, msg = "Good morning!"): >""" >This function greets to >the person with the >provided message. > >If message is not provided, >it defaults to "Good >morning!" >""" > >print("Hello",name +

Re: Function to determine list max without itertools

2019-04-19 Thread Dan Sommers
On 4/19/19 4:01 AM, Sayth Renshaw wrote: Now, what happens when the code is tested with various (different) sets of test-data? (remember the last question from my previous msg!?) It fails on any list entry that isn't a float or an int, giving a TypeError. What if the *first* entry isn't a

Question regarding the __kwdefaults__ output being None

2019-04-19 Thread Arup Rakshit
I have a very basic function. def greet(name, msg = "Good morning!"): """ This function greets to the person with the provided message. If message is not provided, it defaults to "Good morning!" """ print("Hello",name + ', ' + msg) Now when I am calling __kwdefaults__

Re: Function to determine list max without itertools

2019-04-19 Thread Sayth Renshaw
> Now, what happens when the code is tested with various (different) sets > of test-data? > (remember the last question from my previous msg!?) > It fails on any list entry that isn't a float or an int, giving a TypeError. > Once you are happy with the various test-runs, do you have any ideas

Re: Function to determine list max without itertools

2019-04-19 Thread DL Neil
> On 19/04/19 7:23 PM, Sayth Renshaw wrote: In English: Set the first item in the list as the current largest. Compare each subsequent integer to the first. if this element is larger, set integer. Criticism: (because this does NOT match the code, below!) - should

Re: Function to determine list max without itertools

2019-04-19 Thread Sayth Renshaw
On Friday, 19 April 2019 17:01:33 UTC+10, Sayth Renshaw wrote: > Set the first item in the list as the current largest. > Compare each subsequent integer to the first. > if this element is larger, set integer. def maxitwo(listarg): myMax = listarg[0] for item in l

Re: Function to determine list max without itertools

2019-04-19 Thread Sayth Renshaw
Set the first item in the list as the current largest. Compare each subsequent integer to the first. if this element is larger, set integer. -- https://mail.python.org/mailman/listinfo/python-list