Re: [Tutor] Please explain part of this code

2017-02-15 Thread Jim
On 02/15/2017 04:56 PM, Alan Gauld via Tutor wrote: On 15/02/17 22:37, Jim wrote: self.choices = { "1": self.show_notes, "2": self.search_notes, "3": self.add_note, "4": self.modify_note, "5":

Re: [Tutor] Need help with one problem.

2017-02-15 Thread Steven D'Aprano
On Wed, Feb 15, 2017 at 01:00:30PM -0500, Adam Howlett wrote: > Write an if-else statement that assigns 20 to the variable y if the > variable x is greater than 100. Otherwise, it should assign 0 to the > variable y. > > Is there an easy way to solve this problem? Yes. What have you tried?

Re: [Tutor] Memory Error

2017-02-15 Thread Steven D'Aprano
On Wed, Feb 15, 2017 at 09:36:02PM +0330, elham khanchebemehr wrote: > Hi, > I'm trying to write a code in python that takes an array of integers as > sources, an array of integers as sinks, and an array of an array of > integers of capacities, returning the maximum flow. I'm new to python and I >

Re: [Tutor] Need help with one problem.

2017-02-15 Thread Alan Gauld via Tutor
On 15/02/17 18:00, Adam Howlett wrote: > Write an if-else statement that > assigns 20 to the variable y if the variable x is greater than 100. > Otherwise, it should assign 0 to the variable y. > > Is there an easy way to solve this problem? Yes, just do what it says. Maybe if I reword the

Re: [Tutor] Please explain part of this code

2017-02-15 Thread Alan Gauld via Tutor
On 15/02/17 22:37, Jim wrote: > self.choices = { > "1": self.show_notes, > "2": self.search_notes, > "3": self.add_note, > "4": self.modify_note, > "5": self.quit > } > > The author

[Tutor] Need help with one problem.

2017-02-15 Thread Adam Howlett
Write an if-else statement that assigns 20 to the variable y if the variable x is greater than 100. Otherwise, it should assign 0 to the variable y. Is there an easy way to solve this problem? ___ Tutor maillist - Tutor@python.org To unsubscribe or

[Tutor] Memory Error

2017-02-15 Thread elham khanchebemehr
Hi, I'm trying to write a code in python that takes an array of integers as sources, an array of integers as sinks, and an array of an array of integers of capacities, returning the maximum flow. I'm new to python and I got memory error, can you plaese help me because i have no idea how to solve

[Tutor] Please explain part of this code

2017-02-15 Thread Jim
import sys from notebook import Notebook, Note class Menu: '''Display a menu and respond to choices when run.''' def __init__(self): self.notebook = Notebook() self.choices = { "1": self.show_notes, "2": self.search_notes,

Re: [Tutor] Exponential function

2017-02-15 Thread Alan Gauld via Tutor
On 15/02/17 04:43, eryk sun wrote: >> value = 1e5 # or 3e7 or whatever... > > 10**5 is an int and 1e5 is a float. Good point, I'd forgotten about that distinction. > Replacing 10**5 with 10 is a compile-time optimization And didn't know about that one. Thanks for the clarification. --