Re: [Tutor] Help with loops

2018-05-01 Thread Isaac Tetteh
ar", "Bananas"] ] stock = {"Apples": 14, "Bananas": 14, "Pineapples": 0, "Pears": 8} for i in queue: if stock[i[1]] > 0 : print("Gave {} to {}".format(i[1],i[0]))

Re: [Tutor] Installing Python3.6.1 on Ubuntu 16.04.2

2017-07-02 Thread isaac tetteh
Sudo apt install Python 3.6 should be enough. But I would advise to use a virtual environment since you don't want to mess up Ubuntu configuration. Sent from my Verizon LG Smartphone -- Original message-- From: Joseph VOGTEMBING via Tutor Date: Sun, Jul 2, 2017 2:48 PM To: tutor@python.o

Re: [Tutor] (regular expression)

2016-12-10 Thread isaac tetteh
ot;engineering"]))) i used control + f on the link in the code and i get 11 for ctrl + f and 3 for the code THanks From: Tutor on behalf of Bob Gailer Sent: Saturday, December 10, 2016 7:54 PM To: Tetteh, Isaac - SDSU Student Cc: Python Tutor Subject: R

[Tutor] (no subject)

2016-12-10 Thread Tetteh, Isaac - SDSU Student
Hello, I am trying to find the number of times a word occurs on a webpage so I used bs4 code below Let assume html contains the "html code" soup = BeautifulSoup(html, "html.parser") print(len(soup.find_all(string=["Engineering","engineering"]))) But the result is

Re: [Tutor] Adding numbers within a string

2016-10-12 Thread isaac tetteh
def foo(x): a,b = (0,"") for i in x: if i != " ": b+=i else: print ("this is b",b) a = a + int(b) print ("this is a",a) b = "" print ("final a ",a) this should help you solve it. figure a way to add the last number. if any troubles ask again. Thanks [😊] From: Tu

Re: [Tutor] Need reference materials to learn flask + python for payroll project that would run both in windows (PC) and android/iOS.

2016-09-13 Thread isaac tetteh
"Project that will run on both windows and android/iso" if mean its responsiveness then flask cannot do that but css3, javascript(Angular), twitter-bootstrap can help you do that. But if you mean like a desktop/ phone app then maybe check another framework. Check out Flask Web Development: Devel

[Tutor] Fwd: Fwd: Re: need help

2016-08-12 Thread isaac tetteh
Also use good text editor like sublimeText. It will do the indentation for you. Begin forwarded message: > From: Alan Gauld via Tutor > Date: August 12, 2016 at 11:37:11 AM CDT > To: tutor@python.org > Subject: Re: [Tutor] Fwd: Re: need help > Reply-To: Alan Gauld > > >> -- Forwarded

Re: [Tutor] Dictionary Question

2016-05-02 Thread isaac tetteh
If only I understand what you mean. You can just make all the values in the dictionary lower, upper or capitalized. Then if you want take an input or whatever you want to do with it just use .lower() or .upper() or .capitalized() to convert it to what is in the dictionary. Maybe someone has a be

Re: [Tutor] Dictionary Question

2016-05-02 Thread isaac tetteh
Sorry for the if statement the correct statement should be "if 'apple' ==value:" Sent from my iPhone > On May 2, 2016, at 4:58 PM, isaac tetteh wrote: > > > For some reason i cant find reply all . But try this > for key, value in mydic.items(): > I

Re: [Tutor] Dictionary Question

2016-05-02 Thread isaac tetteh
For some reason i cant find reply all . But try this for key, value in mydic.items(): If A==value: Print key Nb: use iteritems() if using python2 Sent from my iPhone > On May 2, 2016, at 4:29 PM, Jason N. via Tutor wrote: > > Hello, > Wanted to ask if its possible to have a d

Re: [Tutor] Issues converting a script to a functioin (or something) [SOLVED]

2016-05-01 Thread isaac tetteh
You have two arguments in you function but when you call the function no argument is set in. Take the arguments out from the function if you want to use the the values from the user. Sent from my iPhone > On May 1, 2016, at 8:41 AM, Olaoluwa Thomas wrote: > > Hi Bob, > > Thanks for your fee

Re: [Tutor] Sorting a list in ascending order

2016-04-29 Thread isaac tetteh
You can use sorted(line) but you result will be in a list if thats okay. Otherwise you can iterate the list. Sent from my iPhone > On Apr 29, 2016, at 3:03 PM, Ken G. wrote: > > In entering five random number, how can I best sort > it into ascending order, such as 0511414453? Using > Linux 2.

Re: [Tutor] Is there a library which has this object?

2016-04-29 Thread isaac tetteh
Im sure its not working because array is not in function. paste the error message here im sure someone will give u a better answer Sent from my iPhone > On Apr 28, 2016, at 4:07 PM, Yeh wrote: > > Thank you! > >> You probably want to look at the itertools module. >> >> There you can find amo

[Tutor] Fwd: List of tuples

2016-04-20 Thread isaac tetteh
> From: isaac tetteh > Date: April 19, 2016 at 9:05:04 PM CDT > To: Danny Yoo > Subject: Re: [Tutor] List of tuples > > Thanks things are working good now. The only problem is i want to print the > for loop output on one line instead of on each line. > Example [1,2,3,

Re: [Tutor] List of tuples

2016-04-20 Thread isaac tetteh
turn row //this is the problem #return str(data) #data=list(data) c.close () conn.close () #return data return render_template("view.html",data=data,formB=formB) error ValueErrorValueError: too many values to unpackTraceback

[Tutor] List of tuples

2016-04-19 Thread isaac tetteh
I have a list like this [ ("name",2344,34, "boy"),("another",345,47,"boy", "last") ] How do u get each value from it like Output name 2344 34 ... What i did was for row in list_tuple: for row2 in row: return row But i get error too many value to unpack Please help Sent from my

[Tutor] i need help with the following question

2013-08-26 Thread isaac Eric
describe different ways of displaying output using python! ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

[Tutor] help

2012-11-19 Thread Isaac Parkes
;Maddy', 'Ursula', 'Annie', 'Stella', 'Kimberely', 'Flora', 'Hannah', 'Bella', 'Ella', 'Rosa', 'Olivia', 'Liya', 'Emma', 'Irene'] boys = [

[Tutor] FW: HELP

2011-04-02 Thread ISAAC Ramírez Solano
Hi... My name is Isaac, I need some help to programm in python, I know some things that are really basic like lists and recursivity and with that we shoul create an GPS with a global variable, but what I'm trying to do is to make a function that could call the global variable can

[Tutor] HELP

2011-04-02 Thread ISAAC Ramírez Solano
Hi... My name is Isaac, I need some help to programm in python, I know some things that are really basic like lists and recursivity and with that we shoul create an GPS with a global variable, but what I'm trying to do is to make a function that could call the global variable can

Re: [Tutor] feedback on permutations script

2010-07-11 Thread Isaac
> On Sun, 11 Jul 2010 02:48:38 am Isaac wrote: > >* This is my interpretation of an algorithm to generate all *> >* permutations of items in a list. I would appreciate any feedback *> >* regarding advice for improvements. **> Steven D'Aprano* wrote: *Sun Jul 11

Re: [Tutor] feedback on permutations script

2010-07-10 Thread Isaac
t, Jul 10, 2010 at 10:18 PM, Isaac wrote: >> >> This is my interpretation of an algorithm to generate all permutations >> of items in a list. I would appreciate any feedback regarding advice >> for improvements. > > Why not try itertools.permutation > >> &g

[Tutor] feedback on permutations script

2010-07-10 Thread Isaac
This is my interpretation of an algorithm to generate all permutations of items in a list. I would appreciate any feedback regarding advice for improvements. Thank you, -Isaac #!/usr/bin/python def add_at_index(new_item, target_array, target_index): """ new_item is a s

Re: [Tutor] request for comments regarding my function

2009-10-25 Thread Isaac
Thank you very much! You certainly gave me plenty to think and read about. I had not known about functools or collections. On Sun, Oct 25, 2009 at 7:09 AM, Rich Lovely wrote: > 2009/10/25 Isaac : >> Hello all, >> I wrote a function to organize a list of sorted objects ( django

[Tutor] request for comments regarding my function

2009-10-24 Thread Isaac
Hello all, I wrote a function to organize a list of sorted objects ( django blog entries ); each object has a Python datetime attribute ( called pub_date ). I am posting a message to the tutor mailing list to get feedback regarding better ways to accomplish the same task. I have a feeling I could u

[Tutor] KeyError: 'DEFAULT'

2009-02-19 Thread Isaac Eiland-Hall
? Also, although I'm not formally requesting feedback on my coding style, that's mainly because I don't want to waste anyone's time. But if you have suggestions, please - I'm open. I'm self-taught and I'm sure I'm doing lots of stupid things. I just hope i

[Tutor] How to foreach over a dynamic number of levels

2009-02-11 Thread Isaac Eiland-Hall
I'm probably trying to go about this the wrong way - so I'm asking more for what direction to head in, at least. The group I'm working with has a python program (the Model Framework) that runs data through a number of models. For each possible step, there are multiple possible models. Each run

[Tutor] How to foreach over a dynamic number of levels

2009-02-11 Thread Isaac Eiland-Hall
I'm probably trying to go about this the wrong way - so I'm asking more for what direction to head in, at least. The group I'm working with has a python program (the Model Framework) that runs data through a number of models. For each possible step, there are multiple possible models. Each run

Re: [Tutor] trouble with function-- trying to check

2007-03-15 Thread Isaac
I see. Thanks for clarifying that for me. -Isaac On 3/15/07, Kent Johnson <[EMAIL PROTECTED]> wrote: Isaac wrote: > In 5.9 of the Language Reference it says: > > "Comparisons can be chained arbitrarily, e.g., |x < y <= z| is > equivalent to |x < y and y &l

Re: [Tutor] trouble with function-- trying to check

2007-03-14 Thread Isaac
ans: item == item and item in word2 not (item == item) and (item in word2) which would first return each value in parentheses and place each value on either side of the boolean operator [ and ] Best regards, -Isaac Bob said: Take a look in 5.9 Comparisons in the Language Reference: "

Re: [Tutor] trouble with function-- trying to check

2007-03-14 Thread Isaac
in 'crab' returns a true/false first because parentheses are more binding than comparisons. Then the outer parentheses is evaluated- c in this case is a and it compares this value/type to the statement returned by the innermost set which previously returned a cheers -Isaac Kent wrote:

Re: [Tutor] trouble with function-- trying to check

2007-03-14 Thread Isaac
As far as I can tell: because (c in "crab") membership is in parentheses it is more binding than the [==] comparison. That is why it returns true/false first. I incorrectly wrote before: " The [in] operator takes precedence" http://docs.python.org/ref/summary.html -Isaac

Re: [Tutor] trouble with function-- trying to check

2007-03-13 Thread Isaac
(c in "crab")) always returns false. (I think) cheers -Isaac reference: http://docs.python.org/ref/summary.html Terry wrote: for c in "abcd": ...print (c == c in "crab"), (c == (c in "crab")) ... True False True False True False False False __

Re: [Tutor] trouble with function-- trying to check

2007-03-13 Thread Isaac
a, b, c are all in crab but d is not. >>> for c in 'abcd': ...print (c == c in 'crab') ... True True True False Message: 5 Date: Tue, 13 Mar 2007 13:01:48 -0700 (PDT) From: Terry Carroll <[EMAIL PROTECTED]> Subject: Re: [Tutor] trouble with function-- trying to check differenc

[Tutor] wav audio playback

2007-02-25 Thread Isaac
hello from a programming newbie. I am writing a metronome function. Currently, I am using a hack with the system bell: [code] def tick(rate): while true: #do until C-c print '\a' #system bell inside terminal time.sleep(rate) #pause at desired rate [/code] I would like to use an

Re: [Tutor] subprocess.Popen.communicate()[]

2006-12-28 Thread Isaac
> "Isaac" > > I have the following in my PYTHONSTARTUP file > > > > def clear(): > >x = subprocess.Popen("clear").communicate(None)[0] > >return x > > > > Yes, but can't you simplify this to just: > > > import s

[Tutor] subprocess.Popen.communicate()[]

2006-12-28 Thread Isaac
Hello tutors! I have the following in my PYTHONSTARTUP file def clear(): x = subprocess.Popen("clear").communicate(None)[0] return x so that when I type: clear() at the prompt, my terminal screen clears and I get only my prompt at the top of the screen. without the index at the end of