Re: [Tutor] Output 'Strings' to directory

2014-09-08 Thread Danny Yoo
On Mon, Sep 8, 2014 at 12:17 PM, Felisha Lawrence wrote: > Is it possible to output strings created from a print statement into a > directory locally? Hi Felisha, Yes. This can be done from the level of your operating system shell, rather than Python, through "output redirection". http://

[Tutor] Fwd: Re: Output 'Strings' to directory

2014-09-09 Thread Danny Yoo
Forwarding to tutor. -- Forwarded message -- From: "Felisha Lawrence" Date: Sep 9, 2014 6:56 AM Subject: Re: [Tutor] Output 'Strings' to directory To: "Danny Yoo" Cc: > So, I ran the following code > > > import os > > path = 

[Tutor] Fwd: Fwd: Re: Output 'Strings' to directory

2014-09-09 Thread Danny Yoo
Felisha, please use reply to all. I'm at work at the moment; can't look at your question. Thanks! Forwarding to tutor. -- Forwarded message -- From: Felisha Lawrence Date: Tue, Sep 9, 2014 at 8:53 AM Subject: Re: [Tutor] Fwd: Re: Output 'Strings' to dir

Re: [Tutor] usage difference between tabs and spaces

2014-09-09 Thread Danny Yoo
> I am not an advanced programmer, but am very good with keyboard and find > using tabs for syntax and formatting very helpful. But in this list and > other python documentation i have repeatedly seen people recommending > use of spaces. Usually, you want to match the style used by the majority o

[Tutor] Fwd: Re: Real world use of recursion

2014-09-09 Thread Danny Yoo
Sorry, forgot to reply to all. -- Forwarded message -- From: "Danny Yoo" Date: Sep 9, 2014 10:10 PM Subject: Re: [Tutor] Real world use of recursion To: "Deb Wyatt" Cc: > > On Sep 9, 2014 8:07 PM, "Deb Wyatt" wrote: > > > > Sorr

Re: [Tutor] Real world use of recursion

2014-09-09 Thread Danny Yoo
Hi Deb, For good training on recursion, I can't think of better material than: http://www.ccs.neu.edu/home/matthias/HtDP2e/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/t

Re: [Tutor] Real world use of recursion

2014-09-10 Thread Danny Yoo
> Any code which walks a tree is almost certainly going to be using > recursion. This is everything from a chess game analyser, to image > processing software, to your browser when it's rendering a web page and > much more in-between. For the comment about Chess, see minmax for a concrete example:

Re: [Tutor] Good approach regarding classes attributes

2014-09-11 Thread Danny Yoo
> I've just again experienced a new employer that tells my students my > name is 'Van Den Broek' when I tell them that it is 'van den Broek.' > This is the third time this week I've encountered this as a > programming example. Perhaps the use of the example is responsible for > the false belief amo

Re: [Tutor] Convert a list to a group of separated strings

2014-09-11 Thread Danny Yoo
On Thu, Sep 11, 2014 at 9:42 AM, Juan Christian wrote: > Let's say I have the following list: my_list = ['76561198048214059', > '76561198065852182', '76561198067017670', '76561198077080978', > '76561198077257977', '7656119807971 > 7745', '76561198088368223', '76561198144945778'] > > and I have a f

Re: [Tutor] python qn

2014-09-11 Thread Danny Yoo
On Thu, Sep 11, 2014 at 8:08 AM, Carmel O'Shannessy wrote: > > Hello, > > times = ['50.319468', '50.319468', 't1'] > > I want to convert [0:2] to floats. > > I tried: > > float.times = [float(i) for i in times[:2]] Hi Carmel, Do you intend to have a variable named "float.times" here on the le

Re: [Tutor] Convert a list to a group of separated strings

2014-09-11 Thread Danny Yoo
> On Thu, Sep 11, 2014 at 2:09 PM, Peter Otten <__pete...@web.de> wrote: >> >> >> You can explode the list by invoking the function with >> >> fetch_users(*my_list) # prepend the list with a star >> >> but I recommend that you change the function's signature to >> >> def fetch_users(steamids): >>

[Tutor] Fwd: python qn

2014-09-11 Thread Danny Yoo
Forwarding to python-tutor. -- Forwarded message -- From: Carmel O'Shannessy Date: Thu, Sep 11, 2014 at 12:18 PM Subject: Re: [Tutor] python qn To: Danny Yoo thanks, this worked: times2 = [float(i) for i in times[:2]] On Thu, Sep 11, 2014 at 1:10 PM, Danny Yoo

Re: [Tutor] Question on dictionary

2014-09-12 Thread Danny Yoo
> i wrote a code like this > > for i in res: > dict = {} > dict['id_desc'] = str(i['id'])+','+str(i['description']) > i.update(dict) > > is there any other simple methods to achieve this? > Can you avoid the intermediate "dict" and just assign to i['id_desc'] directly?

Re: [Tutor] Python program to search videos using Bing

2014-09-12 Thread Danny Yoo
Hard to say. This is not quite Tutor material, so we may not be able to give you good help. ... you seem to be asking the same question here: http://stackoverflow.com/questions/25813510/python-program-to-search-videos-using-bing and hopefully you'll get some more specialized help there.

Re: [Tutor] Python program to search videos using Bing

2014-09-12 Thread Danny Yoo
... looking slightly further. You might want to check with the MSDN forums; there are folks that run into similar issues. e.g.: http://social.msdn.microsoft.com/Forums/azure/en-US/6fb0baac-32d9-4fdd-a083-f596b85cff9b/urgent-paid-subscription-suddenly-403-forbidden-access-is-denied-no-code-c

Re: [Tutor] Help

2014-09-18 Thread Danny Yoo
On Wed, Sep 17, 2014 at 4:36 PM, Art Pelletier wrote: > > I am a beginner with pythons programming I would like to see if their is a > site that has samples programs that I can practice on. Hi Art, Yes, there are some good resources you can check out. Here's a link to some of them: htt

Re: [Tutor] Python Assignment Expression and Callable Expression

2014-09-18 Thread Danny Yoo
> I wish python developers could think of an idea to update the lexical > parsing method or simply provide us a tool to modify it in python context. Hi Lei, This is unfortunately out of scope for Python-tutor. We don't have direct influence over the future direction of the language. If you wa

Re: [Tutor] Question on List of Dict

2014-09-19 Thread Danny Yoo
>{'a': 2, 'b': 'another', 'c': 754}, >{'a': 2, 'b': 'word', 'c': 745} > > if the value of the 'a' is same, then all those other values of the dict should be merged/clubbed. Can you write a function that takes two of these and merges them? Assume that they have the same 'a'. Can

Re: [Tutor] Question on List of Dict

2014-09-19 Thread Danny Yoo
On Sep 19, 2014 12:28 AM, "Danny Yoo" wrote: > > > >{'a': 2, 'b': 'another', 'c': 754}, > >{'a': 2, 'b': 'word', 'c': 745} > > > > > if the value of the &#

Re: [Tutor] Using 'requests' + 'with statement' in Python 3.4.1

2014-09-19 Thread Danny Yoo
> Traceback (most recent call last): > File "C:\[...]\shark.py", line 98, in > main(sys.argv[1]) > File "C:\[...]\shark.py", line 93, in main > fetch_forum() > File "C:\[...]\shark.py", line 79, in fetch_forum > fetch_user(user_url) > File "C:\[...]\shark.py", line 42, in fetch

Re: [Tutor] Using 'requests' + 'with statement' in Python 3.4.1

2014-09-19 Thread Danny Yoo
I should have added that you can write your own context manager for requests; it shouldn't be too bad. I'd expect the helper code to be something like: # class AutoClosable(object): def __init__(self, closable): self.closable = closable def

Re: [Tutor] Using 'requests' + 'with statement' in Python 3.4.1

2014-09-19 Thread Danny Yoo
>> class AutoClosable(object): [cut] > There is also > > Ah, much better! Thanks Peter. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: h

Re: [Tutor] Converting timestamp read as str to "full date and time"

2014-09-19 Thread Danny Yoo
On Fri, Sep 19, 2014 at 4:00 PM, Juan Christian wrote: > Let's say I have ' 1411167038 ' string that I got from an API and I need to > convert it to something like ' Fri, 19 Sep 2014 22:50:38 GMT ' or maybe even > the localtime of the PC. What does that number mean though? Let me guess: is it th

Re: [Tutor] Converting timestamp read as str to "full date and time"

2014-09-19 Thread Danny Yoo
Huh. I should have read your message more closely. Sorry; it's been one of those days for me, it seems... Anyway, can you use ctime()? It looks like that might be almost right: >>> t = 1411167038 >>> datetime.datetime.utcfromtimestamp(t).ctime() 'Fri Sep 19 22:50:38 2014' though i

Re: [Tutor] Subprocess help

2014-09-20 Thread Danny Yoo
> The command I need to run is "BYPASSROOT=yes > ./octosetupBROADCASTER-linux_i386.bin" Semantically, the command above means: execute "./octosetupBROADCASTER-linux_i386.bin" in an environment that binds BYPASSROOT to "yes". The subprocess.Popen command takes in an optional "env" argument,

Re: [Tutor] question 1

2014-09-20 Thread Danny Yoo
On Sat, Sep 20, 2014 at 3:20 PM, Clayton Kirkwood wrote: > I’m ramping slowly unfortunately. How does one go about knowing which module > to import to make certain functions work? I have a read() that fails because > there is no definition for it. Specific details may help here. Can you tell us

Re: [Tutor] question 1

2014-09-20 Thread Danny Yoo
>> Secondarily, why can you import a module without it importing all of its >> daughters? > > The act of importing a module is "recursive": if you import a module, > and that module itself has import statements, then Python will do the > import of the child modules too. And so forth. Hi Deb, Oh!

Re: [Tutor] Python 3: List Comprehensions + range

2014-09-21 Thread Danny Yoo
On Sun, Sep 21, 2014 at 11:11 AM, Juan Christian wrote: > Anyone? Please treat email as asynchronous: sometimes you'll get a response within minutes, but sometimes it takes a little longer. Reading the question quickly... I can't answer this too carefully. I haven't even had breakfast or lunch

Re: [Tutor] Subprocess help

2014-09-21 Thread Danny Yoo
> "Semantically, the command above means: > execute "./octosetupBROADCASTER-linux_i386.bin" in an environment > that binds BYPASSROOT to "yes"." > > Does the above mean "BYPASSROOT" is an environmet variable? Is this created > and set by default by the system or is it created and set by > "octo

[Tutor] Fwd: question 1

2014-09-21 Thread Danny Yoo
Forwarding response to tutor; didn't realize it was only sent to me. -- Forwarded message -- From: Danny Yoo Date: Sun, Sep 21, 2014 at 3:10 PM Subject: Re: [Tutor] question 1 To: Clayton Kirkwood On Sun, Sep 21, 2014 at 2:42 PM, Clayton Kirkwood wrote: >> Secon

[Tutor] Fwd: question 1

2014-09-21 Thread Danny Yoo
Forwarding Clayton's original request to tutor: -- Forwarded message -- From: Clayton Kirkwood Date: Sun, Sep 21, 2014 at 2:42 PM Subject: RE: [Tutor] question 1 To: Danny Yoo > Secondarily, why can you import a module without it importing all of > its daughters?

Re: [Tutor] python code error

2014-09-29 Thread Danny Yoo
On Sun, Sep 28, 2014 at 8:26 AM, Madeleine Austen wrote: > Hi > > Here is my code: > > > from datetime import datetime > timeStart = datetime.now().strftime('%Y-%m-%d %H:%M:%S') > numberPlates = 0 > print("There has been {0} number plates since {1}".format (numberPlates, > timeStart)) > > speedLim

Re: [Tutor] could somebody please explain...

2014-10-01 Thread Danny Yoo
> Also, I found something that I can’t get my mind around. It is part of the > time/date protocols. I’ve not seen it anywhere else. > > Datetime(year=blah, blah, blah).date/time() > > datetime(2013,3,6).date() #returns… > datetime.date(2013,3,6) > > datetime(2013,3,6).time() #returns… > datetime.ti

Re: [Tutor] could somebody please explain...

2014-10-01 Thread Danny Yoo
> !> Also, I found something that I can’t get my mind around. It is part of > !> the time/date protocols. I’ve not seen it anywhere else. > !> > !> Datetime(year=blah, blah, blah).date/time() > !> > !> datetime(2013,3,6).date() #returns… > !> datetime.date(2013,3,6) > !> > !> datetime(2013,3,6).tim

Re: [Tutor] Beautifulsoup4 question

2014-10-01 Thread Danny Yoo
Hi Juan, What you should be getting back from the call to find_all() should already be dictionary-like. Although they *print* like HTML, they're really soups. So you should already be able to do: # full_item_list = self._soup.find_all('li', {'data-app

Re: [Tutor] pygame module

2014-10-03 Thread Danny Yoo
On Fri, Oct 3, 2014 at 2:27 PM, Rob Ward wrote: > i downloaded the 3.4 version of python but there is no matching binary file > for pygame ive tried every 1.9.1 file and still cant import pygame would an > older version of python work You might have better results contacting the Pygame communit

Re: [Tutor] New at Python

2014-10-05 Thread Danny Yoo
On Sun, Oct 5, 2014 at 3:40 PM, Mike Spaulding wrote: > Given that n refers to a positive int use a while loop to compute the sum of > the cubes of the first n counting numbers, and associate this value with > total . Use no variables other than n , k , and total . > > Hi, I am really a rookie at

Re: [Tutor] grave confusion

2014-10-06 Thread Danny Yoo
Alan has pointed out that your loop here: for line_in in file.readline(): ... has a much different meaning that the one you intend. It means: "for every character in the first line of the file: ..." The reason is because "file.readline()" returns a line of your file as a string. A

[Tutor] Fwd: grave confusion

2014-10-06 Thread Danny Yoo
-- Forwarded message -- From: Danny Yoo Date: Mon, Oct 6, 2014 at 11:23 AM Subject: Re: [Tutor] grave confusion To: Clayton Kirkwood > Well the guide certainly doesn't suggest that the read is one character at a > time, it implies one line at a time. However, i

Re: [Tutor] Scaling photos

2014-10-06 Thread Danny Yoo
On Mon, Oct 6, 2014 at 3:08 PM, Jan Erik Moström wrote: > I want to write a small script that scales photos. I want the scaled > photos to keep all meta data available in the originals. I also want > to keep this python only and easily installed on linux and OS X > machines. > > What library would

Re: [Tutor] search/match file position q

2014-10-07 Thread Danny Yoo
> So, what makes regex wrong for this job? question still remains: does the > search start at the beginning of the line each time or does it step forward > from the last search? I will check out beautiful soup as suggested in a > subsequent mail; I'd still like to finish this process:<}} Mathemat

Re: [Tutor] Using xml.etree ElementTree

2014-10-07 Thread Danny Yoo
>> It's working, the thing is that I don't know how to "navigate" inside the >> XML, I read the doc but everything there regarding key-value is on >> for-loops, I need something more direct, like: Hi Juan, I think you're looking for: http://effbot.org/zone/element.htm#searching-for-subeleme

Re: [Tutor] Welcome to the "Tutor" mailing list

2014-10-08 Thread Danny Yoo
> I was reading IDLE tutorial. > The following document dose not exist. > http://www.python.org/idle/doc/ > > It was referenced from https://hkn.eecs.berkeley.edu/~dyoo/python/idle_intro/ > Ok. I'll correct the broken link as soon as I have time. Thanks. _

Re: [Tutor] Welcome to the "Tutor" mailing list

2014-10-08 Thread Danny Yoo
On Wed, Oct 8, 2014 at 12:16 PM, Danny Yoo wrote: > >> I was reading IDLE tutorial. >> The following document dose not exist. >> http://www.python.org/idle/doc/ >> >> It was referenced from >> https://hkn.eecs.berkeley.edu/~dyoo/python/idle_intro/ >>

Re: [Tutor] Tile Code Program

2014-10-10 Thread Danny Yoo
On Fri, Oct 10, 2014 at 8:46 AM, wrote: > This is the prompt: Write an algorithm / pseudocode that: > • Reads in a two integers; the width and length of a room. [code cut] Can you talk a little bit about what problem you're having, if anything? Or are you asking for a code review? It's unclea

Re: [Tutor] Tutorials for experimental psycology

2014-10-10 Thread Danny Yoo
On Fri, Oct 10, 2014 at 3:41 PM, Alan Gauld wrote: > On 10/10/14 18:47, Z wrote: >> >> I am familiar with basics of programming, and wanted to learn how to >> code psychology experiments in python. Are there standard >> libraries/tutorials and/or GUI-based software? > > > Yes, but a lot depends on

Re: [Tutor] How to use custom protocol with requests?

2014-10-11 Thread Danny Yoo
On Sat, Oct 11, 2014 at 7:29 PM, Juan Christian wrote: > I need to call this URL: steam://friends/add/ > > If I put it in my browser and press enter it works as expected, now I need > to do this on my code, I don't need to retrieve anything, I just need it to > be "executed", is there a way to do

Re: [Tutor] How to use custom protocol with requests?

2014-10-11 Thread Danny Yoo
On Sat, Oct 11, 2014 at 7:58 PM, Juan Christian wrote: > Sorry for triple post, but yes, webbrowser worked 100%. Exactly what I > needed! Huh. Wow. That actually worked? :P --- Frankly speaking though, this sounds like a horrible XSRF-style attack in waiting, if I understand what has just h

Re: [Tutor] How to use custom protocol with requests?

2014-10-11 Thread Danny Yoo
>> I need to call this URL: steam://friends/add/ >> >> If I put it in my browser and press enter it works as expected, now I need >> to do this on my code, I don't need to retrieve anything, I just need it to >> be "executed", is there a way to do that in Python with requests or any >> other lib?

Re: [Tutor] Return Statement error

2014-10-12 Thread Danny Yoo
On Oct 12, 2014 9:52 AM, "William Becerra" wrote: > > Hello, I'm new to programming. I'm using Python 2.7.8 and Windows 8 OS > I was making an application to see if I understand how the return statement works > I want my application to compare x and y and return either 1, -1 or 0. > I'm using ID

Re: [Tutor] Help with guess my number game

2014-10-13 Thread Danny Yoo
> > if guess != the_number: > > print ("you failed, the number was", the_number) > > elif guess==the_number: > > print("You guessed it! The number was", the_number) > > print("And it only took you", tries, "tries!\n") This block of code appears to be applied for e

[Tutor] Fwd: Re: Help with guess my number game

2014-10-13 Thread Danny Yoo
-- Forwarded message -- From: אופיר לירון Date: Mon, Oct 13, 2014 at 1:20 PM Subject: Re: Re: [Tutor] Help with guess my number game To: Danny Yoo Hi Danny Thanks for your response, I think it is part of the problem, but my intention was to end the first loop only after 5

Re: [Tutor] Convert Qstring to string in windows

2014-10-16 Thread Danny Yoo
On Thu, Oct 16, 2014 at 8:21 AM, C@rlos wrote: > > I have been tryed to convert a Qstring text to string on python, in linux > that work fine but in windows when qstring contine á,é,í,ó,ú the converted > text is not correct, contine extranger characters, > this qstring text is an url from qdialogt

Re: [Tutor] python draw christman tree using loops

2014-10-19 Thread Danny Yoo
In Java, System.out represents the standard output device. In Python, there's a similar value in sys.stdout. https://docs.python.org/2/library/sys.html#sys.stdout In your Python program, you should be able to say: import sys at the beginning of your program, and then use: sys.st

Re: [Tutor] Need help to convert pdf to excel

2014-10-19 Thread Danny Yoo
On Sun, Oct 19, 2014 at 7:27 AM, AMNA MOHAMMED ALRUHEILI wrote: > My name is Amna and I am totally new to python world with zero experience in > programming. I am facing the challenge of converting data from pdf to excel. > The data within pdf is numbers separated by space not within a table. > I

Re: [Tutor] Python sqlite3 issue

2014-10-20 Thread Danny Yoo
Hi Juan, On Mon, Oct 20, 2014 at 10:04 AM, Juan Christian wrote: > I have this code (http://pastebin.com/Q21vQdHZ): > > import sqlite3 [code cut] > def insert_db(_id, url, author, message): > db.execute("INSERT INTO TOPICS (ID, URL, AUTHOR, MESSAGE) VALUES ({}, > {}, {}, {})".format(_id,

Re: [Tutor] Python sqlite3 issue

2014-10-20 Thread Danny Yoo
insert_db(12, "abc.com", "author", "message") > INSERT INTO TOPICS (ID, URL, AUTHOR, MESSAGE) VALUES (12, abc.com, > author, message) > > I've never used format like that. It looks like you need to quote the > strings. I don't know if you can tell format to do that or if you > have to e

Re: [Tutor] Full screen mode

2014-10-21 Thread Danny Yoo
On Tue, Oct 21, 2014 at 2:14 PM, Nathan Spencer wrote: > Hi there, > > I'm running python on Scientific Linux. The problem is that I'm permanently > stuck in full screen mode. Exiting out of that mode (via F11) doesn't do > anything. Do you have any suggestions? Hmmm... unfortunately, I do no

Re: [Tutor] Is there a convenient table of Python 3.4 exceptions?

2014-10-23 Thread Danny Yoo
> I have so far been unable to find a list of these class/subclass names. Of > course I can force an error to occur in the interpreter and see what comes > up for each type of error I wish to catch. Is there such a table or list? > Hi Bob, You can find the ones used in the Standard Library here:

Re: [Tutor] Auto-response for your message to the "Tutor" mailing list

2014-10-26 Thread Danny Yoo
>> why is it I get this messages repeatedly despite having been reading and writing on the list for over a year now? This has happened to me once in a while too. I conjecture that it might be a bug with Mailman, but I'd have to dive into the code to be certain. ___

Re: [Tutor] Python GPIO Code Help Needed

2014-10-26 Thread Danny Yoo
>> def changed(channel): >> newstate = GPIO.input(channel) >> change = oldstates[channel] and not newstate >> oldstates[channel] = newstate Hi Bill, I would suggest documenting the intent of this function, as it isn't obvious at first. A comment string would be approp

Re: [Tutor] Would somebody kindly...

2014-10-28 Thread Danny Yoo
On Tue, Oct 28, 2014 at 4:13 PM, Clayton Kirkwood wrote: > Explain this double speak(>: > > [pair for pair in values if key == pair[0]] Hi Clayton, Here is a rewording of that expression to an approximately equivalent statement: ### some_list = [] for pair in values: if

Re: [Tutor] passing named arguments through command line

2014-10-30 Thread Danny Yoo
On Thu Oct 30 2014 at 7:58:32 AM Lukas Nemec wrote: > Hello, > > take a look at argparse library. > Hi Robert, As Lukas mentions, it sounds like you're looking for a "flag parsing" library. A flag parsing library reads a set of key/value pairs that are encoded in sys.argv, so they let comman

Re: [Tutor] Newbie Trouble Processing SRT Strings In Text File

2014-10-31 Thread Danny Yoo
[code cut] Hi Matt, It looks like you're trying to write your own srt parser as part of this problem. If you're in a hurry, you may want to look at existing parsers that people have written. For example: https://github.com/byroot/pysrt But, even though it successfully kills these additi

Re: [Tutor] Practicing with sockets

2014-10-31 Thread Danny Yoo
On Fri Oct 31 2014 at 10:31:20 AM Bo Morris wrote: > Hello all, hope everyone is doing well. > > I have been practicing with sockets and I am trying to send a small png > from the client to the server. > Hey Bo, Very cool! Socket programming is fun, because it lets your programs start talking

Re: [Tutor] Practicing with sockets

2014-10-31 Thread Danny Yoo
> > > I also reread the docs at https://docs.python.org/2/howto/sockets.html and > decided to remove the "b" from "open('myfile.png', 'wb') open('myfile.png', > 'rb') seeing how binary could be different depending on the machine and I > have not yet learned how to deal with this. > Whoa, wait. I

Re: [Tutor] eval use (directly by interpreter vs with in a script)

2014-11-02 Thread Danny Yoo
Hi Alex, Just as a side note, someone has probably already told you something like this, but: I would strongly recommend not to use Python's eval() or exec(). Those language features are dangerous. Every eval() or exec() is a possible vector for injection attacks. This week's injection attack

Re: [Tutor] eval use (directly by interpreter vs with in a script)

2014-11-02 Thread Danny Yoo
> I use exec to jump to another program within the > same directory, such as: > > execfile("BloodPressure02Sorting.py") > > and let the program terminate there. Should I do > it differently or are you talking about a different > horse? This is related. Rather than use execfile, you may want to c

Re: [Tutor] eval use (directly by interpreter vs with in a script)

2014-11-03 Thread Danny Yoo
On Mon Nov 03 2014 at 10:04:41 AM Alan Gauld wrote: > On 03/11/14 17:33, Albert-Jan Roskam wrote: > > > I sometimes do something like > > ifelse = "'teddybear' if bmi > 30 else 'skinny'" > > weightcats = [eval(ifelse) for bmi in bmis] > > > > Would this also be a *bad* use of eval? It can be avoi

Re: [Tutor] eval use (directly by interpreter vs with in a script)

2014-11-03 Thread Danny Yoo
On Mon Nov 03 2014 at 10:48:29 AM Danny Yoo wrote: > On Mon Nov 03 2014 at 10:04:41 AM Alan Gauld > wrote: > >> On 03/11/14 17:33, Albert-Jan Roskam wrote: >> >> > I sometimes do something like >> > ifelse = "'teddybear' if bmi > 30 else

Re: [Tutor] Remove artca...@google.com from mailing list, PLEASE

2014-11-04 Thread Danny Yoo
Hi Art, You may imagine a very busy administrator sending messages to each user individually, but that's now how computer-based mailing lists work these days. If you wish to unsubscribe, please visit the following url: https://mail.python.org/mailman/listinfo There's a form there that you c

Re: [Tutor] Remove artca...@google.com from mailing list, PLEASE

2014-11-04 Thread Danny Yoo
s/that's now how/that's not how On Tue Nov 04 2014 at 10:27:57 AM Danny Yoo wrote: > Hi Art, > > You may imagine a very busy administrator sending messages to each user > individually, but that's now how computer-based mailing lists work these > days. > >

Re: [Tutor] Remove artca...@google.com from mailing list, PLEASE

2014-11-04 Thread Danny Yoo
> > > @google.com and @gmail.com both work and resolve to the same mailbox, > just fyi. Something wasn't terribly efficient of notifying people of. > > So if you have a @gmail.com, you also have @google.com > > [Apologies for the off-toplic nature of my post. I'll stop after this.] As a correctio

Re: [Tutor] Project tree

2014-11-10 Thread Danny Yoo
> Traceback (most recent call last): > File "E:\tests\project_name\start.py", line 1, in > from src import moda > File "E:\tests\project_name\src\moda.py", line 1, in > import modb > ImportError: No module named 'modb' Hi Wiktor, In Python 3, imports are not relative by default.

[Tutor] Silencing a speaker

2014-11-11 Thread Danny Yoo
On Nov 11, 2014 4:30 AM, "Ben Smith" wrote: > > Hi - I'm a teacher & sometimes when we're holding a two minute silence for an important occasion an > email comes through & makes my computer ping loudly. Is there a python script to stop these kind of things happening? Lo tech solution: can you plu

[Tutor] Fwd: Project tree

2014-11-11 Thread Danny Yoo
-- Forwarded message - From: Wiktor Matuszewski Date: Tue Nov 11 2014 at 4:47:10 AM Subject: Re: [Tutor] Project tree To: Danny Yoo W dniu 2014-11-11 o 03:02, Danny Yoo pisze: > See: https://docs.python.org/3/tutorial/modules.html#intra- package-references > for more d

Re: [Tutor] Error Cannot Import Name Core

2014-11-11 Thread Danny Yoo
On Tue Nov 11 2014 at 5:17:53 PM Felisha Lawrence < felisha.lawre...@gmail.com> wrote: > Hello, > I am trying to install a version of pyart in OSX and I keep getting this > error > > --ImportError >

Re: [Tutor] “has a value of True” versus “evaluates true”

2014-11-11 Thread Danny Yoo
On Tue Nov 11 2014 at 3:09:38 PM Ben Finney wrote: > "Clayton Kirkwood" writes: > > > So, there is a difference between None and False, is that the issue? > > Yes. Those two values are different and not equal; but both evaluate > false in a boolean context. > > Just to note; not all programming

Re: [Tutor] Creating Table

2014-11-12 Thread Danny Yoo
On Wed, Nov 12, 2014 at 11:33 AM, wrote: > Create a table based on two user inputs. Have the user enter two integers > between 2 and 6. Validate the user inputs are in the proper range as they > are entered. The first integer represents the number of rows in the table. > The second integer rep

Re: [Tutor] “has a value of True” versus “evaluates true”

2014-11-13 Thread Danny Yoo
> Unlike some languages, which choose confusing and arbitrary sets of > values that count as truthy or falsey, Python encourages a simple > distinction, something versus nothing. Values which represent some kind > of "nothing" are falsey: Hi Steven, Sure. I'm not arguing that Python's choices o

Re: [Tutor] Help understanding classes

2014-11-14 Thread Danny Yoo
On Fri, Nov 14, 2014 at 4:29 PM, Bo wrote: > Hello everyone, hope all is well. Was just wondering if I could get some > help understanding classes and how they work. What is the point in OOP if I > don’t understand classes, are classes not the heart and soul of OOP? I have > been trying to learn c

Re: [Tutor] bubble sort function

2014-11-16 Thread Danny Yoo
Hi Spyros, Ok, reading the code... > def bubbleSort_ascending(unsorted): > """ Sorts a list of numbers in ascending order """ > n = len(unsorted) > count = swaps = 0 > swapped = True > ## Prompt user to choose if they want to see each sorting step > option = raw_input("Sho

Re: [Tutor] bubble sort function

2014-11-16 Thread Danny Yoo
> def ask_for_a_digit(): > while True: > digit = raw_input("Give me a digit between 0 and 9.") > if digit not in "0123456789": > print "You didn't give me a digit. Try again." > else: > return int(digit) Ooops. I made a mistake. ask_for_a_dig

Re: [Tutor] Fw: Traceback

2014-11-18 Thread Danny Yoo
On Tue, Nov 18, 2014 at 1:46 PM, wrote: > I get this message: > Traceback (most recent call last): > File "C:\Program Files (x86)\Wing IDE 101 > 5.0\src\debug\tserver\_sandbox.py", line 87, in > File "C:\Program Files (x86)\Wing IDE 101 > 5.0\src\debug\tserver\_sandbox.py", line 20, in main

Re: [Tutor] Fw: Traceback

2014-11-18 Thread Danny Yoo
On Tue, Nov 18, 2014 at 4:34 PM, niyana morgan wrote: > Okay yeah this helping. > I believe getNumber does actually return a number. Ok. But check again. :p You should be using a "return" statement in some part of there. Read: http://www.greenteapress.com/thinkpython/html/thinkpython00

Re: [Tutor] Fw: Traceback

2014-11-18 Thread Danny Yoo
On Tue, Nov 18, 2014 at 4:40 PM, Danny Yoo wrote: > On Tue, Nov 18, 2014 at 4:34 PM, niyana morgan wrote: >> Okay yeah this helping. >> I believe getNumber does actually return a number. > > > Ok. But check again. :p In your original getNumber, you may be thinking o

[Tutor] Fwd: Fw: Traceback

2014-11-18 Thread Danny Yoo
Forwarding to tutor. -- Forwarded message -- From: Danny Yoo Date: Tue, Nov 18, 2014 at 4:56 PM Subject: Re: [Tutor] Fw: Traceback To: niyana morgan On Tue, Nov 18, 2014 at 4:48 PM, niyana morgan wrote: > Read the link. So I need to put > Return roomWidth and room

[Tutor] Fwd: Fw: Traceback

2014-11-18 Thread Danny Yoo
-- Forwarded message -- From: niyana morgan Date: Tue, Nov 18, 2014 at 4:59 PM Subject: Re: [Tutor] Fw: Traceback To: Danny Yoo Exercise 1: def distance(x1, y1, x2, y2): dx = x2 - x1 dy = y2 - y1 dsquared = dx**2 + dy**2 result = math.sqrt(dsquared) print

Re: [Tutor] Fw: Traceback

2014-11-18 Thread Danny Yoo
On Tue, Nov 18, 2014 at 5:01 PM, Danny Yoo wrote: > -- Forwarded message -- > From: niyana morgan > Date: Tue, Nov 18, 2014 at 4:59 PM > Subject: Re: [Tutor] Fw: Traceback > To: Danny Yoo > > > Exercise 1: > def distance(x1, y1, x2, y2): > d

Re: [Tutor] Fw: Traceback

2014-11-19 Thread Danny Yoo
>> Exercise 1: >> def distance(x1, y1, x2, y2): >> dx = x2 - x1 >> dy = y2 - y1 >> dsquared = dx**2 + dy**2 >> result = math.sqrt(dsquared) >> print(result) >> return result > > > That's not exercise 1. Try again. > > >Exercise 1 >Write a compare function that retur

[Tutor] Fwd: Fw: Traceback

2014-11-19 Thread Danny Yoo
-- Forwarded message -- From: niyana morgan Date: Wed, Nov 19, 2014 at 5:43 PM Subject: Re: [Tutor] Fw: Traceback To: Danny Yoo No I am still stuck on what to do and this is a major project for my class. On Nov 19, 2014 6:21 PM, "Danny Yoo" wrote: > > >>

Re: [Tutor] Fw: Traceback

2014-11-19 Thread Danny Yoo
> On Nov 19, 2014 6:21 PM, "Danny Yoo" wrote: >> >Exercise 1 >> >Write a compare function that returns 1 if x > y, 0 if x == y, and >> > -1 if x < y. >> > >> > >> > I have to get back to work so hopefully others on

Re: [Tutor] Dividing a float derived from a string

2014-11-20 Thread Danny Yoo
> I have been posed with the following challenge: > > "Create a script that will ask for a number. Check if their input is a > legitimate number. If it is, multiply it by 12 and print out the result." > > I was able to do this with the following code: > > input = raw_input("Insert a number: ") > if

Re: [Tutor] Dividing a float derived from a string

2014-11-20 Thread Danny Yoo
On Thu, Nov 20, 2014 at 3:05 PM, Stephanie Morrow wrote: > What else could I do in that testing portion that would allow for a decimal > point? In order for a decimal to be True, it would have to accept both the > digits and the decimal point. Let's tackle a problem that's tangent but related,

Re: [Tutor] Enquiry on technology stack to use

2014-11-22 Thread Danny Yoo
I'm not sure if we on tutor are the best folks to provide advice on this subject. You may want to ask on a more general forum such as: https://mail.python.org/mailman/listinfo/python-list Good luck! ___ Tutor maillist - Tutor@python.org To unsubscrib

Re: [Tutor] How python keeps track of objects

2014-11-23 Thread Danny Yoo
On Nov 23, 2014 8:48 AM, "Mitch Raful" wrote: > > Thanks for the replies. My concern was as the for loop keeps sending objects into the do_something() function which uses the same reference name other_object and that the previously instantiated other_objected would be mutated if the function was

Re: [Tutor] (no subject)

2014-11-29 Thread Danny Yoo
> When I run the code using the IDLE the Python shell gives me the following > error > > Traceback (most recent call last): > File "/home/william/Desktop/Pygame/Python 3X/Drawing_Shapes.py", line 48, in > > font = pygame.font.SysFont('Calibri', 25, True, False) > File "/usr/local/lib/python3.4/dis

Re: [Tutor] Tutor

2014-12-05 Thread Danny Yoo
On Fri, Dec 5, 2014 at 12:05 PM, Joel Goldstick wrote: > On Fri, Dec 5, 2014 at 11:37 AM, Marina Woodson > wrote: >> I am looking for a tutor. I have a project due in a couple of days and >> cannot complete the code on my own. How does this system here work? > > You may find someone who would be

Re: [Tutor] getting input for stdin

2014-12-07 Thread Danny Yoo
> I need to get the stdin input from the text I type into the same text file > that I have stdout at. How do I do that. None of the answers at > stackoverflow got me going. Any help on a code snippet would be appreciated. In-place edits of a file are dangerous, especially as a beginner. This is be

Re: [Tutor] Coding

2014-12-07 Thread Danny Yoo
On Sun, Dec 7, 2014 at 7:27 AM, Awais Idris <2010-3...@slougheton.com> wrote: > Hi there, I'm currently in secondary school yr 11 studying the computing > course and I've been set a task in creating a vending machine code. I found > some coding online and I have changed some of it, but it still doe

<    15   16   17   18   19   20   21   22   >