Re: [Tutor] Help with Python code

2016-02-29 Thread Alan Gauld
On 29/02/16 17:31, Donald Woolfolk wrote: > Hello, > > I am new to Python 3.5 and I am writing code to get data > from a session api call and load that data into a csv file > or a MySQL database. That's great, we can help with that, but... > I am able to make the session call and also to conne

Re: [Tutor] Help with date range

2016-02-09 Thread Alan Gauld
On 09/02/16 15:34, Chelsea G wrote: > Then in the csv file I want to search for a certain range of dates like > 1/3/2016 - 2/3/2016. I can get individual dates but not a range of dates. Can ytou simplify the problem momentaruily? Can you create a list of dates then search that list for a range o

Re: [Tutor] Help with date range

2016-02-09 Thread Martin A. Brown
Greetings Chelsea, >So what I am trying to do is take in a csv file and the format of >the csv file is: While I do not have a suggestion to you about the Python you have sent to the list, I have a few suggestions about how to approach the problem differently. I hope that this may make your t

Re: [Tutor] Help with date range

2016-02-09 Thread Joel Goldstick
On Tue, Feb 9, 2016 at 10:34 AM, Chelsea G wrote: > So what I am trying to do is take in a csv file and the format of the csv > file is: > something, something1, something2,something3, something4, something5, > something6, something7. > Then in the csv file I want to search for a certain range of

Re: [Tutor] Help needed

2016-02-04 Thread Alan Gauld
On 04/02/16 23:26, Tom Brodle wrote: > While true: > Turn LED on > sleep 5 seconds > Turn LED off > sleep .5 seconds > # Coming from the world of Basic I did/do not understand what made the > program loop > # back to while True: line of c

Re: [Tutor] Help needed

2016-02-04 Thread Joel Goldstick
On Thu, Feb 4, 2016 at 6:26 PM, Tom Brodle wrote: > I am very new to Python. I am just practicing code using a simple plug > board. The code is working as I want it to but the last message and the > original looping makes me have questions. Because the main code works I > will just abbreviate

Re: [Tutor] Help with error

2016-02-02 Thread Alan Gauld
On 02/02/16 15:37, Chelsea G wrote: > 'issues' and output those results into a text file. I just need some help > with figuring out how to fix the error I am receiving. Joel has already pointed out the indentation error in your class. However there is another problem... but possibly not with you

Re: [Tutor] Help with error

2016-02-02 Thread Joel Goldstick
First, Please try to be more creative with your message subject line. Help, isn't -- helpfull Second. Don't paraphrase the error, copy it from your actual terminal screen and paste it here. See below On Tue, Feb 2, 2016 at 10:37 AM, Chelsea G wrote: > Hi, > When I run my code I am getting an

Re: [Tutor] Help with printing to text file

2016-02-01 Thread Steven D'Aprano
On Mon, Feb 01, 2016 at 08:41:31PM +, Alan Gauld wrote: > On 01/02/16 14:07, Chelsea G wrote: > > Hi, > > > > So I am trying to get my function search to print in a text file, but I > > can only get it to print to Powershell. I have tried several things to get > > it to print in its own text

Re: [Tutor] Help with printing to text file

2016-02-01 Thread Cameron Simpson
On 01Feb2016 20:41, ALAN GAULD wrote: On 01/02/16 14:07, Chelsea G wrote: So I am trying to get my function search to print in a text file, but I can only get it to print to Powershell. I have tried several things to get it to print in its own text file but nothing I have tried is working. Can

Re: [Tutor] Help with printing to text file

2016-02-01 Thread Joel Goldstick
On Mon, Feb 1, 2016 at 9:07 AM, Chelsea G wrote: > Hi, > > So I am trying to get my function search to print in a text file, but I > can only get it to print to Powershell. I have tried several things to get > it to print in its own text file but nothing I have tried is working. Can > someone te

Re: [Tutor] Help with printing to text file

2016-02-01 Thread Alan Gauld
On 01/02/16 14:07, Chelsea G wrote: > So I am trying to get my function search to print in a text file, but I > can only get it to print to Powershell. I have tried several things to get > it to print in its own text file but nothing I have tried is working. Can > someone tell me what I am doing

Re: [Tutor] Help with printing to text file

2016-02-01 Thread Alan Gauld
On 01/02/16 14:07, Chelsea G wrote: > Hi, > > So I am trying to get my function search to print in a text file, but I > can only get it to print to Powershell. I have tried several things to get > it to print in its own text file but nothing I have tried is working. Can > someone tell me what I a

Re: [Tutor] Help

2016-01-26 Thread boB Stepp
In case you cannot see what we are talking about in how your message is not keeping its proper indentation, go to the Tutor Mail Archive at: https://www.mail-archive.com/tutor@python.org/msg73411.html and perhaps you can better see the difficulty we are having reading your message. boB _

Re: [Tutor] Help

2016-01-26 Thread Alan Gauld
On 26/01/16 20:57, Chelsea G wrote: > ...I have the basic code for it... Sorry, when I said paste it in the message I should have also pointed out that you need to ensure the mail tool is sending plain text, otherwise we lose all indentation. But this looks like the same code as before so I'm gue

Re: [Tutor] help!

2016-01-26 Thread Alan Gauld
On 26/01/16 18:05, Chelsea G wrote: > creating a keyword search. For example, if I want to search for the word > Tool in the value and see what keys are associated with that. So say the > value I have to search is Tool World and I want to know what key is > associated with Tool World I search Tool

Re: [Tutor] help!

2016-01-26 Thread Joel Goldstick
On Tue, Jan 26, 2016 at 1:05 PM, Chelsea G wrote: > Hi, > I am working on a python script to automate reporting. And I am working on > creating a keyword search. For example, if I want to search for the word > Tool in the value and see what keys are associated with that. So say the > value I have

Re: [Tutor] Help!

2016-01-25 Thread Alan Gauld
On 25/01/16 17:39, Chelsea G wrote: > Hi, > I am trying to create a keyword search, so that someone can type in a key > phrase and then the output be the value with the key. I'm not completely clear what you mean by a key phrase? Do you mean a phrase matching the keys in your dictionary?(In whic

Re: [Tutor] Help!

2016-01-17 Thread Steven D'Aprano
On Fri, Jan 15, 2016 at 11:33:24AM -0500, Chelsea G wrote: > Hi, [snip stuff which is, as far as I can see, irrelevant] > What I am having issues with is the def txt_output that is where I am > trying to take the .csv off and add the .txt but keep the filename the > same. For example, having a fi

Re: [Tutor] Help!

2016-01-15 Thread Peter Otten
Chelsea G wrote: > What I am having issues with is the def txt_output that is where I am > trying to take the .csv off and add the .txt but keep the filename the > same. For example, having a filename "weekly_20160102.csv" and then create > a txt filename with "weekly_20160102.txt" and have all th

Re: [Tutor] HELP!!

2016-01-12 Thread Alan Gauld
On 12/01/16 20:36, Chelsea G wrote: > data = defaultdict(list) > > class dictionary: >with open ('weekly_20160102.csv', 'rb') as f: > reader = csv.reader(f) > next(reader, None) > for row in reader: > data[row[2]].append(row[3]) > for key in data.keys(): >

Re: [Tutor] HELP!!

2016-01-12 Thread Danny Yoo
On Tue, Jan 12, 2016 at 12:36 PM, Chelsea G wrote: > So I am importing a csv file to textfile and the first column is product > names and the second is a description of each. I am trying to find the sum > of all descriptions using sum(c.values)). Here is my code so far: [code cut] Code is someti

Re: [Tutor] HELP!!

2016-01-12 Thread Joel Goldstick
On Tue, Jan 12, 2016 at 3:36 PM, Chelsea G wrote: > So I am importing a csv file to textfile and the first column is product > names and the second is a description of each. I am trying to find the sum > of all descriptions using sum(c.values)). Here is my code so far: > > import csv > import jso

Re: [Tutor] help with existing code

2016-01-07 Thread Peter Otten
Brianna McGee wrote: > I am a new to programming and have started out with modifying existing > code to suit my purposes in my Developmental Psychology lab. The script > worked fine previous to my fiddling with it, but now that I am trying to > modify the x and y locations based upon a text file w

Re: [Tutor] Help with loops

2016-01-05 Thread Joel Goldstick
On Tue, Jan 5, 2016 at 12:27 PM, Chelsea G wrote: > I need to create a loop to print out the most common phrases with the > counts 5 or greater and the rest to be bucketed into other category. How do > I write the loop to print out the common phrases that have counts of 5 or > more? This is my co

Re: [Tutor] help!

2015-12-19 Thread Mark Lawrence
On 20/12/2015 00:33, Alan Gauld wrote: On 19/12/15 17:39, Nathaniel Olivier via Tutor wrote: I don't understand what's wrong with this piece of code? It does help if you give a more meaningful subject when asking, otherwise trying to find a specific thread in the archives is all but impossib

Re: [Tutor] help!

2015-12-19 Thread Alan Gauld
On 19/12/15 17:39, Nathaniel Olivier via Tutor wrote: > I don't understand what's wrong with this piece of code? Thee are several problems > print ("The Flying Circus recently entered your town and are doing a never > seen before performance") > answer=raw_input("Shall you go? Type Yes or No to a

Re: [Tutor] help!

2015-12-19 Thread Steven D'Aprano
On Sat, Dec 19, 2015 at 05:39:15PM +, Nathaniel Olivier via Tutor wrote: > I don't understand what's wrong with this piece of code? > print (" SyntaxError here. If you want multiply lines in a string, use THREE quotation marks, not one: print (""" more than one line of text """)

Re: [Tutor] Help with returning a list object from a C extension.

2015-11-28 Thread Oscar Benjamin
On 28 Nov 2015 12:06, "James Oren" wrote: > > Hi all, this is my first time using the mailing list. > > I'm trying to learn how to use C to extend my code, and have already worked > out how to use ctypes. I'm now trying to learn the full C extension module > approach with Python.h and have worked

Re: [Tutor] Help with returning a list object from a C extension.

2015-11-28 Thread Alan Gauld
On 28/11/15 15:59, Laura Creighton wrote: >> effort than ctypes to call a library function? I can't see any advantage, >> so what am I missing? > > Ctypes is slow. Aha. Performance is always the invisible feature. I only ever use ctypes to access OS features that don't have a Python equivalent

Re: [Tutor] Help with returning a list object from a C extension.

2015-11-28 Thread Laura Creighton
In a message of Sat, 28 Nov 2015 12:46:11 +, Alan Gauld writes: >On 28/11/15 12:29, Laura Creighton wrote: >> Most people I know have abandoned ctypes. They are using cffi instead. > >Really? Why? >I'd never heard of cffi before, but looking at the docs it seems like a >lot more >effort than c

Re: [Tutor] Help with returning a list object from a C extension.

2015-11-28 Thread Alan Gauld
On 28/11/15 12:29, Laura Creighton wrote: > Most people I know have abandoned ctypes. They are using cffi instead. Really? Why? I'd never heard of cffi before, but looking at the docs it seems like a lot more effort than ctypes to call a library function? I can't see any advantage, so what am I m

Re: [Tutor] Help with returning a list object from a C extension.

2015-11-28 Thread Laura Creighton
In a message of Sat, 28 Nov 2015 12:22:12 +, Alan Gauld writes: >On 28/11/15 06:04, James Oren wrote: > >> I'm trying to learn how to use C to extend my code, and have already worked >> out how to use ctypes. I'm now trying to learn the full C extension module >> approach with Python.h and have

Re: [Tutor] Help with returning a list object from a C extension.

2015-11-28 Thread Laura Creighton
In a message of Sat, 28 Nov 2015 12:22:12 +, Alan Gauld writes: >On 28/11/15 06:04, James Oren wrote: > >> I'm trying to learn how to use C to extend my code, and have already worked >> out how to use ctypes. I'm now trying to learn the full C extension module >> approach with Python.h and have

Re: [Tutor] Help with returning a list object from a C extension.

2015-11-28 Thread Alan Gauld
On 28/11/15 06:04, James Oren wrote: > I'm trying to learn how to use C to extend my code, and have already worked > out how to use ctypes. I'm now trying to learn the full C extension module > approach with Python.h and have worked through the Python doc and a couple > other examples. OK, This

Re: [Tutor] Help

2015-11-25 Thread Laura Creighton
In a message of Wed, 25 Nov 2015 03:29:38 +, chantie sunday via Tutor write s: >Hello!,Can I kindly get someone to help me with my assignment? Thank you!Best >Regards,Chantelle Hi, and welcome. We don't do people's assignments, but we do help them write them. Post the assignment and the code

Re: [Tutor] Help

2015-11-25 Thread Alan Gauld
On 25/11/15 03:29, chantie sunday via Tutor wrote: > Hello!,Can I kindly get someone to help me with my assignment? Thank you!Best > Regards,Chantelle Sure, we will help you, but we won't do the assignment for you, just give you pointers in the right direction. But first you need to tell us: Wh

Re: [Tutor] Help - International School in Spain

2015-11-17 Thread Mike Straw
Caroline, The parentheses change the interpretation for the print statement. If you put it without the parentheses, it will work fine. print "Mashed ",veg," on the ceiling." Also, another note: the spaces at end of the first string and the start of the third string aren't necessary. When you use

Re: [Tutor] Help - International School in Spain

2015-11-17 Thread Peter Otten
Peter Otten wrote: >> print("Mashed ",veg," on the ceiling.") An unrelated note: Python automatically adds spaces between the printed values, so the output of print("Mashed", veg, "on the ceiling.") will look better. ___ Tutor maillist - Tutor@py

Re: [Tutor] Help - International School in Spain

2015-11-17 Thread Peter Otten
caroline metcalf wrote: > Hi there > > I am having an issue. This code normally works fine > > Code: > veg="carrots" > print("Mashed ",veg," on the ceiling.") > print("Green beans on the floor.") > print("Stewed tomatoes in the corner.") > print("Squash upon the door.") > > But, I am getting t

Re: [Tutor] Help - International School in Spain

2015-11-17 Thread Alan Gauld
On 17/11/15 12:27, caroline metcalf wrote: veg="carrots" print("Mashed ",veg," on the ceiling.") print("Green beans on the floor.") But, I am getting this. Result: ('Mashed ', 'carrots', ' on the ceiling.') Green beans on the floor. I have tried semi-colons instead of commas as Spain uses

Re: [Tutor] Help - International School in Spain

2015-11-17 Thread Pa Yo
Might you be using two single inverted commas '' rather than one inverted comma " Just a thought. Also check the use of acute accents and inverted commas, they are easy to mix up on a Spanish keyboard - depending on the font you use. PY On Tuesday, 17 November 2015, caroline metcalf < caroline.m

Re: [Tutor] Help with return results statement.

2015-10-22 Thread Danny Yoo
An additional suggestion: > = > # Add your functions below! > def average(numbers): > total = sum(numbers) > total = total / len(numbers) > return total Don't re-assign total here. The problem is that conceptually "total" no longer represents the total in the second assignment.

Re: [Tutor] Help with return results statement.

2015-10-22 Thread Vusa Moyo
Thanks Alan. Removed that . = # Add your functions below! def average(numbers): total = sum(numbers) total = total / len(numbers) return total def get_average(student): homework = average(student["homework"]) quizzes = average(student["quizzes"]) tests = average(stude

Re: [Tutor] Help with return results statement.

2015-10-22 Thread Alan Gauld
On 22/10/15 10:03, Vusa Moyo wrote: Hi Guys. Thanks for the responses and assistance. I came right after-all. The last 2 blocks read the following. Glad you are happy but there is still something you could improve: def get_class_average(students): results = [] for a in students:

Re: [Tutor] Help with return results statement.

2015-10-22 Thread Vusa Moyo
Hi Guys. Thanks for the responses and assistance. I came right after-all. The last 2 blocks read the following. def get_class_average(students): results = [] for a in students: b = float(get_average(a)) results.append(b) return average(results) students = [lloyd, al

Re: [Tutor] Help with return results statement.

2015-10-20 Thread Alan Gauld
On 20/10/15 12:29, Vusa Moyo wrote: Hi there. My script is as follows, alice = { "name": "Alice", "homework": [100.0, 92.0, 98.0, 100.0], "quizzes": [82.0, 83.0, 91.0], "tests": [89.0, 97.0] } # Add your function below! def average(numbers): >total = sum(numbers) >

Re: [Tutor] Help with return results statement.

2015-10-20 Thread Steven D'Aprano
Hi Vusa, and welcome. On Tue, Oct 20, 2015 at 01:29:59PM +0200, Vusa Moyo wrote: > Hi there. My script is as follows, [...] > def get_class_average(students): > results = [] > for a in students: > b = int(get_average(a)) > results.append([b]) > return results I'

Re: [Tutor] Help with else

2015-10-09 Thread Enes Unal
may be this one? name = raw_input("What is your name") print "Great! Now %s, are you a boy or a girl?" % (name) gender = raw_input("") if gender == "boy": print " I can see that, you are very strong" elif gender == "girl": print ' Yes, and a beautiful one' else: print "Y

Re: [Tutor] Help with else

2015-10-09 Thread Alan Gauld
On 09/10/15 04:31, Nick Brodsky wrote: name = raw_input("What is your name") print "Great! Now %s, are you a boy or a girl?" % (name) gender = raw_input("") if gender == "boy": print " I can see that, you are very strong": if gender == "girl": print ' Yes, and a beautiful one': else:

Re: [Tutor] Help error 504

2015-08-26 Thread Peter Otten
Danny Yoo wrote: > Unit tests that depend on external dependencies can be "flaky": they > might fail for reasons that you don't anticipate. I'd recommend not > depending on an external web site like this: it puts load on someone > else, which they might not appreciate. If you have a well-defined

Re: [Tutor] Help error 504

2015-08-25 Thread Danny Yoo
Unit tests that depend on external dependencies can be "flaky": they might fail for reasons that you don't anticipate. I'd recommend not depending on an external web site like this: it puts load on someone else, which they might not appreciate. Making the test not depend on the network is not ba

Re: [Tutor] Help error 504

2015-08-25 Thread Laura Creighton
Thanks Timo! I never heard of this one before! Laura ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Help error 504

2015-08-25 Thread Peter Otten
Timo wrote: > Op 25-08-15 om 02:08 schreef Gonzalo V: >> how can simulate or emulate an error 504? > I think using a site like http://httpbin.org/ is a bit easier than mock > or your own server. > Just change your request url to: > http://httpbin.org/status/504 Yes, that's nice! Plus, it's

Re: [Tutor] Help error 504

2015-08-25 Thread Timo
Op 25-08-15 om 02:08 schreef Gonzalo V: how can simulate or emulate an error 504? I think using a site like http://httpbin.org/ is a bit easier than mock or your own server. Just change your request url to: http://httpbin.org/status/504 Timo i am new in python and its very intuitive! but

Re: [Tutor] Help error 504

2015-08-25 Thread Peter Otten
Gonzalo V wrote: > i am new in python and its very intuitive! but i am in problems with that > code. As Danny already explained an exception can only be caught if the function is inside a try ... except ...: try: req = urllib.request.urlopen(...) except urllib.error.HTTPError as e: ...

Re: [Tutor] Help error 504

2015-08-25 Thread Laura Creighton
I use mock for this. See this blog post which explains it much clearer than I could. http://engineroom.trackmaven.com/blog/real-life-mocking/ Laura ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.pyt

Re: [Tutor] Help error 504

2015-08-25 Thread Danny Yoo
In your program, you have a try/ except block, but it does not surround the line: req=urllib.request.urlopen(''+line) You probably should modify the extent of the exception handling to include that part. If you are seeing a 504, I expect it to come at this point. __

Re: [Tutor] Help

2015-08-10 Thread Cameron Simpson
On 10Aug2015 11:40, Alex Kleider wrote: On 2015-08-10 11:13, Emile van Sebille wrote: On 8/10/2015 10:07 AM, Alan Gauld wrote: PS. What is SDSU? San Diego State University I'd guess. Emile South Dakota State is the other possibility. They seem to addreviate to sdstate. At least as a do

Re: [Tutor] Help

2015-08-10 Thread Cameron Simpson
On 10Aug2015 18:07, ALAN GAULD wrote: PS. What is SDSU? Google told me San Diego State University. Cheers, Cameron Simpson To be positive: To be mistaken at the top of one's voice. Ambrose Bierce (1842-1914), U.S. author. The Devil's Dictionary (1881-1906). _

Re: [Tutor] Help

2015-08-10 Thread Alex Kleider
On 2015-08-10 11:13, Emile van Sebille wrote: On 8/10/2015 10:07 AM, Alan Gauld wrote: PS. What is SDSU? San Diego State University I'd guess. Emile South Dakota State is the other possibility. ___ Tutor maillist - Tutor@python.org To unsubscr

Re: [Tutor] Help

2015-08-10 Thread Alan Gauld
On 10/08/15 19:14, Shannon Callahan wrote: Telling me about it...being kook for beginner. The first thing you should do is focus on getting Python onto your Mac and going through a basic tutorial. If you've programmed before in another language then you can use the official tutorial on pyhon.or

Re: [Tutor] Help

2015-08-10 Thread Emile van Sebille
On 8/10/2015 10:07 AM, Alan Gauld wrote: PS. What is SDSU? San Diego State University I'd guess. Emile ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Help

2015-08-10 Thread Alan Gauld
Forwarding to list for completeness. Please use reply All when responding to the list. On 10/08/15 18:17, Shannon Callahan wrote: > So it is really hard to make such code for it? It's hard for a beginner. It's non-trivial for an expert. But there are libraries such as Google's speech to text li

Re: [Tutor] Help

2015-08-10 Thread Alan Gauld
On 10/08/15 03:10, Shannon Callahan wrote: -I am trying to have it able to hear like three specific commands such as "hey, hello, sir". That's a very ambitious target for someone who is new to Python. In fact that's quite an ambitious plan even for someone experienced in Python - unless you h

Re: [Tutor] Help

2015-08-10 Thread Cameron Simpson
On 09Aug2015 19:10, Shannon Callahan wrote: Sorry for my lack of clear explanation. Yes, I am having problem to install python into my mac laptop. -I am trying to install python into my mac laptop Macs normally ship with Python installed already, version 2.7. If you need a specific version,

Re: [Tutor] Help

2015-08-10 Thread Shannon Callahan
Sorry for my lack of clear explanation. Yes, I am having problem to install python into my mac laptop. -I am trying to install python into my mac laptop -I am trying to learn how to execute the possible finished code -I am trying to create a code so I can transfer it into SD card so I can put it i

Re: [Tutor] Help

2015-08-09 Thread Steven D'Aprano
Hi Shannon, and welcome, My comments below yours: On Sun, Aug 09, 2015 at 03:14:38PM -0700, Shannon Callahan wrote: > To anybody, > > I am new to this with so small experiences. I am struggle to get around > with python's install that connect with Mac's terminal. Basically, I am > trying to make

Re: [Tutor] Help with Pygame

2015-08-08 Thread Mark Lawrence
On 07/08/2015 23:50, franklinsco...@gmail.com wrote: I downloaded pygame and tried testing it and it didn't work. I tried the latest version of pygame and it didn't work again. I tried moving the file to the place I think the import code gets programs from so it could open pygame. It didn't wo

Re: [Tutor] Help with Pygame

2015-08-07 Thread Alan Gauld
On 07/08/15 23:50, franklinsco...@gmail.com wrote: I downloaded pygame and tried testing it and it didn't work. Traceback (most recent call last): File "C:\Python34\Lib\idlelib\Showdot.py", line 1, in import pygame ImportError: No module named 'pygame' It certainly looks like an ins

Re: [Tutor] Help Command Question

2015-07-28 Thread Mark Lawrence
On 28/07/2015 18:00, ltc.hots...@gmail.com wrote: Hi Everyone, I'm trying to print a command of list options by using the help command in the iPython interpreter. Read captured copy of the printout as follows: 'Python 2.7.10 |Anaconda 2.3.0 (64-bit)| (default, May 28 2015, 16:44:52) [MSC v.

Re: [Tutor] Help Command Question

2015-07-28 Thread Martin A. Brown
Hi there, In [1]: help list File "", line 1 help list ^ SyntaxError: invalid syntax.' Question: What is the correct help command? Try: help(list) Snipped from my ipython session: In [1]: help(list) Good luck, -Martin -- Martin A. Brown http://linux-ip.net/ _

Re: [Tutor] Help with List

2015-07-26 Thread Steven D'Aprano
On Sun, Jul 26, 2015 at 10:04:19AM +0530, Anurag Vyas wrote: > Hello Team, > I am noob to programming. I am trying to remove a item from a list. The > item that I am trying to remove has multiple entries in the list. I am not > able to remove all the entries. > Please Help. The code is in the attac

Re: [Tutor] Help

2015-07-24 Thread Alan Gauld
On 24/07/15 17:37, abhijeet...@yahoo.in wrote: I wanted to develop any application for my college project using python. OK, That is easy enough, what kind of application do you have in mind? An office tool? A game? A web site? There are lots of possibilities. I have the basic of the languag

Re: [Tutor] Help

2015-07-24 Thread Mark Lawrence
On 24/07/2015 17:37, abhijeet...@yahoo.in wrote: Dear Pythonist I wanted to develop any application for my college project using python .I have the basic of the language and wanted to develop any real time software or application .I am not getting any help or idea you know i am just getting a

Re: [Tutor] Help understanding list comprehensions

2015-06-18 Thread Laura Creighton
In a message of Thu, 18 Jun 2015 04:40:05 -, Anubhav Yadav writes: >So I need to create a copy of the list before trying to iterate through the >list. >Thanks a lot everyone for their answers. Er, I think you understand, but what you need to do is to make a copy of the list, and _interate thro

Re: [Tutor] Help understanding list comprehensions

2015-06-18 Thread Alan Gauld
On 18/06/15 05:40, Anubhav Yadav wrote: So I need to create a copy of the list before trying to iterate through the list. Only if you are going to change it. The problem you had was that you were removing items from the thing you were iterating over. As a result the other items effectively move

Re: [Tutor] Help understanding list comprehensions

2015-06-18 Thread Anubhav Yadav
So I need to create a copy of the list before trying to iterate through the list. Thanks a lot everyone for their answers. Cheers. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/list

Re: [Tutor] Help understanding list comprehensions

2015-06-17 Thread Alan Gauld
On 17/06/15 09:58, Anubhav Yadav wrote: I understand that my title was a little misleading, and I apologise for the same. Here is code that worked: marks = [] for i in range(int(input())): Don't use input(). Use raw_input() instead. You almost never want input() in python 2. name = raw

Re: [Tutor] Help understanding list comprehensions

2015-06-17 Thread Laura Creighton
In a message of Wed, 17 Jun 2015 14:28:54 +0530, Anubhav Yadav writes: >Either the subject is misleading or you misunderstand something. Im am >sorry to tell you the great truth, but there was no list comprehension in >your code at all, just a list. Comprehension is what Alan wrote for you, >that

Re: [Tutor] Help understanding list comprehensions

2015-06-17 Thread Anubhav Yadav
Either the subject is misleading or you misunderstand something. Im am sorry to tell you the great truth, but there was no list comprehension in your code at all, just a list. Comprehension is what Alan wrote for you, that is the next step in studying Python, when you already understand lists and

Re: [Tutor] Help understanding list comprehensions

2015-06-17 Thread Válas Péter
Either the subject is misleading or you misunderstand something. Im am sorry to tell you the great truth, but there was no list comprehension in your code at all, just a list. Comprehension is what Alan wrote for you, that is the next step in studying Python, when you already understand lists and

Re: [Tutor] Help understanding list comprehensions

2015-06-16 Thread Anubhav Yadav
I am sorry I didn't posted my code. I had solved this question long back on hackerrank, and I couldn't figure out why this behaviour was seen in this problem, so I had posted this question on their discussion forum. Couldn't get a good answer so I decided to post here. Luckily I found the revision

Re: [Tutor] Help understanding list comprehensions

2015-06-16 Thread Alan Gauld
On 16/06/15 20:39, Anubhav Yadav wrote: I am sorry I didn't posted my code. I had solved this question long back on hackerrank, and I couldn't figure out why this behaviour was seen in this problem, so I had posted this question on their discussion forum. Couldn't get a good answer so I decided

Re: [Tutor] Help understanding list comprehensions

2015-06-16 Thread Válas Péter
What is the exact meaning of "marks" and "lowest" in your script? Where are they defined?0 ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Help understanding list comprehensions

2015-06-16 Thread Alan Gauld
On 16/06/15 16:45, Anubhav Yadav wrote: I have a doubt. So have I. I can't se your code so I don't know what's happening. Don't make us guess, show us the code. I had a list like this [['Varun', 19.0], ['Kakunami', 19.0], ['Harsh', 20.0], ['Beria', 20.0], ['Vikas', 21.0]] But its not assig

Re: [Tutor] Help with writing a bean bag toss game in python

2015-05-20 Thread Laura Creighton
In a message of Tue, 19 May 2015 19:53:00 -0700, Grace Anne St Clair-Bates writ es: >Hello! I am trying to code a bean-bag toss game in python where the program >generates three random dots inside a turtle graphic. Each different hole >means a different score, but I don't know how to write the func

Re: [Tutor] Help with writing a bean bag toss game in python

2015-05-20 Thread Alan Gauld
On 20/05/15 03:53, Grace Anne St Clair-Bates wrote: Hello! I am trying to code a bean-bag toss game in python where the program generates three random dots inside a turtle graphic. Each different hole means a different score, but I don't know how to write the function to calculate the total score

Re: [Tutor] Help!

2015-05-15 Thread Steven D'Aprano
On Fri, May 15, 2015 at 07:35:30PM -0400, Fredrick Barrett wrote: > print ("Lets play a game") > > import random > > # Generate random number from 1-10 > rand_value = random.randint(1,10) > guess = input("Guess a number from 1-10 ") Here you guess once. > if guess == rand_value: > print (

Re: [Tutor] Help Learn python - Step by Step

2015-05-10 Thread Albert-Jan Roskam via Tutor
On Sat, May 9, 2015 7:08 PM CEST boB Stepp wrote: >On Sat, May 9, 2015 at 3:23 AM, acolta wrote: >> >> Hi guys, >> >> I want to start coding in python. My background is Linux/Bash/Perl >> (begginner). >> My appreciate if somebody will recommend books/tutorials + exe

Re: [Tutor] Help Learn python - Step by Step

2015-05-09 Thread Nym City via Tutor
I am on the same boat. I have tried using online sites like codeacademy  and courses on courser but now I am starting with this new book called "Automate The Boring Stuff with Python". So far so good. Thank you. On Saturday, May 9, 2015 8:41 AM, acolta wrote: Hi guys, I want to

Re: [Tutor] Help Learn python - Step by Step

2015-05-09 Thread Andrei Colta
Thanks for sharing, will try it. Cheers, Andrei On 9 May 2015 15:45, "Nym City" wrote: > I am on the same boat. I have tried using online sites like codeacademy > and courses on courser but now I am starting with this new book called > "Automate The Boring Stuff with Python". So far so good. >

Re: [Tutor] Help Learn python - Step by Step

2015-05-09 Thread Alan Gauld
On 09/05/15 09:23, acolta wrote: I want to start coding in python. My background is Linux/Bash/Perl (begginner). My appreciate if somebody will recommend books/tutorials + exercises to practice. If you are happy writing basic shell/perl scripts then you can probably jump straight into the off

Re: [Tutor] Help Learn python - Step by Step

2015-05-09 Thread Alex Kleider
On Sat, May 9, 2015 at 3:23 AM, acolta wrote: Hi guys, I want to start coding in python. My background is Linux/Bash/Perl (begginner). My appreciate if somebody will recommend books/tutorials + exercises to practice. I first cut my Python teeth using http://www.greenteapress.com/thinkpyt

Re: [Tutor] Help Learn python - Step by Step

2015-05-09 Thread boB Stepp
On Sat, May 9, 2015 at 3:23 AM, acolta wrote: > > Hi guys, > > I want to start coding in python. My background is Linux/Bash/Perl > (begginner). > My appreciate if somebody will recommend books/tutorials + exercises to > practice. This question comes up quite frequently. If you have not done so

Re: [Tutor] help

2015-04-07 Thread Alan Gauld
On 07/04/15 21:52, Francesca Ghidelli wrote: Hello,First of all, i'm not trying to learn how to program with Python. OK. So how exactly are you using Python? > I use Blender for my project, Blender 2.49b uses Python262. This is a list for folks learning Python so we don't necessarily know muc

Re: [Tutor] Help

2015-03-07 Thread Mark Lawrence
On 07/03/2015 19:04, Alan Gauld wrote: On 07/03/15 15:39, elie khairallah wrote: hello , I would like to know if theres a way to change a variable's name after every iteration for example I want to make a function that stores a number in x_1 if i=1 and in x_2 if i=2. To be more precise: i=1 def

Re: [Tutor] Help

2015-03-07 Thread Alan Gauld
On 07/03/15 15:39, elie khairallah wrote: hello , I would like to know if theres a way to change a variable's name after every iteration for example I want to make a function that stores a number in x_1 if i=1 and in x_2 if i=2. To be more precise: i=1 def f(n): while i Others have alrea

Re: [Tutor] Help

2015-03-07 Thread Danny Yoo
> You could certainly use I as an index into a list called x. This > doesn't look like a good idea though Can you explain more what's problematic with a list? My best understanding so far of the problem is that the original questioner is trying to compute a tabulation of results. For example,

Re: [Tutor] Help

2015-03-07 Thread Danny Yoo
On Sat, Mar 7, 2015 at 7:39 AM, elie khairallah wrote: > hello , I would like to know if theres a way to change a variable's name > after every iteration for example I want to make a function that stores a > number in x_1 if i=1 and in x_2 if i=2. Conceptually, I think you're looking for a list.

<    1   2   3   4   5   6   7   8   9   10   >