Re: python

2020-02-23 Thread Souvik Dutta
Try it yourself first. It is very easy.

On Sun, Feb 23, 2020, 1:00 PM luka beria  wrote:

> hi guys i have another question.how to  find the minimum and maximum
> numbers in this list without using the min () and max () functions use
>  while loop
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python

2020-02-23 Thread Grant Edwards
On 2020-02-22, Python  wrote:
> lberia...@gmail.com wrote:
>> hi guys can you help me.how to find maximum and minimum in list using while 
>> loop python
>
> l = [1, 4, 2, -1, 0, 4, 2, 1, 10]
> for i in range(100):
>  pass
>   
> maximum = max(l)
> minimum = min(l)

The requirement is to use a _while_ loop:

l = [1, 4, 2, -1, 0, 4, 2, 1, 10]
while True:
maximum = max(l)
minimum = min(l)
break


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Help with oop

2020-02-23 Thread DL Neil via Python-list

On 22/02/20 10:45 PM, S Y wrote:

How can I use remove,add and verify methods in class oop. Which has tuple with 
allowed values inside class. Like two classes cart and inventory


Please show the code you have so-far.
What are you removing, adding, and verifying?
Are you aware of the Python-Tutor Discussion List?

--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list


Re: Help with oop

2020-02-23 Thread DL Neil via Python-list

On 24/02/20 10:45 AM, S Y wrote:
""" The class Baggage will track inventory items added to or removed 
from it. Inventory items will be represented by
inventory item objects created using the ‘InventoryItem’ class. When an 
attempt is made to add an inventory
item to a Baggage object, the number of items in the Baggage object is 
compared with maximum capacity and
allowable items. If space is left and the item is allowed, the item is 
added, otherwise, the class returns a response indicating failure with a 
short reason why"""

class Baggage:
  #Constructor - sets initial values for all object attributes.
  def __init__(self,capacity, inventory= [],allow_items=()):
  self.inventory = []
  self.capacity = 5
  self.allow_items = (

...

  #Adds an item object to the Baggage object after checking that the mx 
capacity has not been reached (i.e. 5 items)

  def add_item(self, item_object):
  if len(self.inventory) <= self.capacity:
  self.inventory.append(item_object)
  return True
  else:
  print("Reached max capacity")
  return False


 on behalf of DL 
Neil via Python-list 

*Sent:* Sunday, February 23, 2020 4:41:54 PM
*To:* python-list@python.org 
*Subject:* Re: Help with oop
On 22/02/20 10:45 PM, S Y wrote:

How can I use remove,add and verify methods in class oop. Which has tuple with 
allowed values inside class. Like two classes cart and inventory


Please show the code you have so-far.
What are you removing, adding, and verifying?
Are you aware of the Python-Tutor Discussion List?


Given that the data-structure is a list, perhaps list.remove()?
What is the relevance of Baggage.allow_items()?

Sorry to be nagging you but perhaps take a look at how Discussion Lists 
work:

- top/bottom posting, ie not answer then question,
- replying to list (not individual) so that others may also benefit,
- formatting and readability (cf 'Microsoft makes it look nice because 
they know better than you')


WebRef:
5. Data Structures¶
https://docs.python.org/3/tutorial/datastructures.html
--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list


Managing plug-ins

2020-02-23 Thread DL Neil via Python-list

Please recommend a library which will manage plug-ins.


(Regret that searching PyPi or using a web SE results in an overwhelming 
number of 'false positives')


Not wanting to 'reinvent the wheel, have been looking for an 'approved' 
way to manage a set of previously-prepared routines plus user-added 
functionality:

- user selects particular type of analysis (cmdLN)
- take that string and convert to a function/method
- 'plug-in' code could be located within application
- 'plug-in' could be 'included' from user
- interface standardisation/checking not part of question
- Python3

Application is statistical analysis. Users want to control aspects such 
as data selection/inclusion policies, other data 
pre-processing/massaging, distribution curve to be applied, and similar.
NB not looking for stats-code, but to easily manage a range of plug-ins 
from which users may select to suit their particular research objective.

--
Regards,
=dn
--
https://mail.python.org/mailman/listinfo/python-list