Re: [Tutor] I Need Help

2016-08-24 Thread Alan Gauld via Tutor
On 24/08/16 19:12, Micheal Emeagi wrote: > This is what it is suppose to be > [1, 1, 1.5, 2.25, 3.125, 4.06, 5.03] Oh good, it looks like my wild guess was right. :-) enjoy, -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow

Re: [Tutor] tkinter/sqlite3?

2016-08-26 Thread Alan Gauld via Tutor
On 26/08/16 02:34, Jim Byrnes wrote: > Exception in Tkinter callback > Traceback (most recent call last): ... >File "tk_pwds.py", line 56, in fill_accounts_lb > cur.execute('''SELECT Account FROM pwds WHERE Category=? ORDER BY > Account COLLATE NOCASE''', category) > sqlite3.ProgrammingE

Re: [Tutor] syntax error help

2016-08-26 Thread Alan Gauld via Tutor
On 30/03/16 19:05, Awais Mamoon wrote: > Hi my code should be working however keeps coming up with invalid syntax but > I know there isn’t one. You are wrong. There is. I suspect the error message tells you where it is. In future please include the full error message with your code. Look closely

Re: [Tutor] Running Python code without python installed

2016-08-27 Thread Alan Gauld via Tutor
On 27/08/16 07:26, Jade Beckmann wrote: > I'm just wondering how someone who doesn't have the python software > installed on their PC or mac would be able to run the program? They can't. You need the interpreter to be able to run Python code. The good news is that Macs come with Python installed

Re: [Tutor] Problem

2016-08-28 Thread Alan Gauld via Tutor
On 28/08/16 15:46, shahan khan wrote: Theorem: If it is possible to buy x, x+1,…, x+5 sets of McNuggets, for some x, then it is possible to buy any number of McNuggets >= x, given that McNuggets come in 6, 9 and 20 packs. Here is my code: for a in range(1,10): for b in range(1,5): for c in ra

Re: [Tutor] Problem

2016-08-29 Thread Alan Gauld via Tutor
On 28/08/16 23:53, shahan khan wrote: I changed the code a bit and this is the result: for a in range(1,11): for b in range(1,6): for c in range(1,6): mc=(6*a)+(9*b)+(20*c) if mc==50: print 'For 50 McNuggets:''a=',a,'b=',b,'c=',c if mc==51: print 'Fpr 51 McNuggets:''a=',a,'b=',b,'c=',c if mc==52:

Re: [Tutor] __init__

2016-08-29 Thread Alan Gauld via Tutor
On 29/08/16 20:03, monik...@netzero.net wrote: If __init__ is not defined in a class, will it be called when creating an instance? What in a case if this class inherits from parent with __init__ and without __init__? The easiest way to find out is try it and see what happens! Just put appro

Re: [Tutor] Error help

2016-08-30 Thread Alan Gauld via Tutor
On 30/08/16 03:22, Matthew Lehmberg wrote: I've been getting this error over and over and was wondering if someone could help me fix it. [image: Inline image 1] This is a text mailing list so attachments dont get through. Plese repost with your error message cut n paste into the message. Alan

Re: [Tutor] __init__

2016-08-30 Thread Alan Gauld via Tutor
On 29/08/16 23:52, monik...@netzero.net wrote: I cannot really try it. If I have a class without __init__ and the class does not > inherit from a class that has init there is really no place > for me to put print statement. Fair enough but in that case there is no __init__ to call. The top l

Re: [Tutor] __init__

2016-08-30 Thread Alan Gauld via Tutor
On 30/08/16 12:50, eryksun wrote: On Tue, Aug 30, 2016 at 9:09 AM, Alan Gauld via Tutor wrote: new() that sets up the memory then calls init(). So init is only used to initialise the object after it has been constructed. __new__ and __init__ are called by the metaclass __call__ method

Re: [Tutor] ImportError: cannot import name

2016-08-30 Thread Alan Gauld via Tutor
On 30/08/16 10:25, fa306...@skynet.be wrote: Hello, I use python 3.5.1 and try to import sompy and get the following error: File "C:\Anaconda3\lib\site-packages\sompy-1.0-py3.5.egg\sompy\__init__.py", line 30, in from sompy import SOMFactory ImportError: cannot import name 'SOMFactory' Wh

Re: [Tutor] __init__

2016-08-30 Thread Alan Gauld via Tutor
On 30/08/16 17:59, monik...@netzero.net wrote: Assume you have a child class with no init, but it has empty, > default __init__ provided by pathon It inherits the empty init from object. and the same for its parent class. When instantiating child class, > child class's __new__ calls its __

Re: [Tutor] __init__

2016-08-30 Thread Alan Gauld via Tutor
On 30/08/16 22:08, monik...@netzero.net wrote: OK so somebodys remark that there is a default __init__ provided was not correct. It depends on how you interpret default. In so far as object is the default superclass (in v3) and it provides an init then there is a default, but its not part of

Re: [Tutor] generator object

2016-08-31 Thread Alan Gauld via Tutor
On 31/08/16 05:12, monik...@netzero.net wrote: So generator function returns generator object according to Aaron Maxwell. I don't believe that's correct. A generator function can return any kind of object including basic types like numbers, bool etc.In addition, a generator function yields va

Re: [Tutor] generator object

2016-08-31 Thread Alan Gauld via Tutor
On 31/08/16 08:56, Alan Gauld via Tutor wrote: > A generator function can return any kind of object including > basic types like numbers, bool etc.In addition, a generator > function yields values which can also be of any type. Hmmm. After reading Steven's response I played around

Re: [Tutor] generator object

2016-08-31 Thread Alan Gauld via Tutor
On 31/08/16 23:24, Alan Gauld via Tutor wrote: > Then I tried > ... > x = list(2) Should be list(gen(2)) I hope that was obvious... -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr

Re: [Tutor] Help with NameError

2016-09-01 Thread Alan Gauld via Tutor
On 01/09/16 02:29, Bryan Callow wrote: > Could someone help me with a NameError that I can't seem to figure out. It is hard for us to figure out without seeing the error message. It should tell you which name is in error and where. Please repost with the full error message included. -- Alan G A

Re: [Tutor] Inheritance vs Assignment

2016-09-01 Thread Alan Gauld via Tutor
On 01/09/16 04:18, kay Cee wrote: > Class a(): > def__init__(self, var): > pass > > Class b(a): > def__init__(self): > super().__init__(self, var) > pass > Is it better to do > > b = a() > > Instead of making b its own class? > Also, what would be the ben

Re: [Tutor] python memory management

2016-09-01 Thread Alan Gauld via Tutor
On 01/09/16 15:12, monik...@netzero.net wrote: > Can somebody please explain how memory is managed by python? > What kind of memory it uses? What structures use what kind of memory? I'm not sure what you have in mind? Do you want to know the internal structure of the various data types? Do you wa

Re: [Tutor] Issue while using the python library

2016-09-02 Thread Alan Gauld via Tutor
On 02/09/16 15:07, Girish Grover wrote: > I am trying to use a python package from github and struggling to make it > work. Looking for experts to help me out. Technically its off topic for this list which is for core language and standard library issues. But if you were to tell us what package a

Re: [Tutor] What's the correct way to define/access methods of a member variable in a class pointing to an object?

2016-09-03 Thread Alan Gauld via Tutor
On 03/09/16 06:55, Sharad Singla wrote: > What's the correct way to define/access methods of a member variable in a > class pointing to an object? Steven has already given you a long and comprehensive answer based on pragmatic python programming. But since you use the term "correct" I'll give you

Re: [Tutor] python memory management

2016-09-03 Thread Alan Gauld via Tutor
On 03/09/16 04:25, monik...@netzero.net wrote: > Is this what you mean? > a = 5 > b = a > a = b No, you are confusing variable names with objects. Here you only have one object - the number 5. For a cycle you need at least 2 objects and those objects must be able to reference another object. In

Re: [Tutor] What's the correct way to define/access methods of a member variable in a class pointing to an object?

2016-09-03 Thread Alan Gauld via Tutor
On 03/09/16 18:17, Steven D'Aprano wrote: > One classic example of the Law Of Demeter is: > > "If you want your dog to come to you, don't talk to your dog's legs, > talk to the dog." I love that, I've never seen it before but a great example. > But sometimes the Law Of Demeter should not apply

Re: [Tutor] python memory management

2016-09-03 Thread Alan Gauld via Tutor
On 03/09/16 22:16, monik...@netzero.net wrote: > So what does [...] mean? Its Python's way of telling you that you have a self referential data structure. Its just a representational thing but without it Python would end up printing an infinite sequence of values. HTH -- Alan G Author of the Le

Re: [Tutor] python memory management

2016-09-03 Thread Alan Gauld via Tutor
On 03/09/16 23:20, zakaria wrote: > Is there any practical usage of using reference cycling? There are a (very) few cases where data structures require the creation of cyclic references. One example I've used is in managing comms networks where nodes are multiply and/or cyclically linked and you n

Re: [Tutor] cannot find html file, in the same dir as python file

2016-09-05 Thread Alan Gauld via Tutor
On 05/09/16 21:59, monik...@netzero.net wrote: > chromedriver = "resources/chromedriver" > os.environ["webdriver.chrome.driver"] = chromedriver > self.driver = webdriver.Chrome(chromedriver) > base_url = 'button.html' > self.driver.get(base_url) > > FileNot

Re: [Tutor] cannot find html file, in the same dir as python file

2016-09-06 Thread Alan Gauld via Tutor
On 06/09/16 03:18, monik...@netzero.net wrote: > I put > > print( os.getcwd() ) > > into my script, and got > > C:\Users\Monika\Documents\PythonWeb\class3code\class3code Is that the directory you expected? Is it where your html file lives? > So I put into my script: > > base_url = > 'C:\Users\

Re: [Tutor] crashes

2016-09-07 Thread Alan Gauld via Tutor
On 07/09/16 13:21, Rosalie de Klerk Bambara wrote: > Im trying to install python on my macbook air, I’ve installed these 3 > versions and deinstalled too. Python 2.7 should be installed by default since MacOS uses it. > By typing a ‘ the IDLE crash every time… > after the first ( the idle stops

Re: [Tutor] Hello!

2016-09-09 Thread Alan Gauld via Tutor
On 09/09/16 17:21, Eric Gardner wrote: > I don't know if i'm sending the email to the right address but here it > goes!. Would Python be a suitable language for first time learners like me? Yes, this is the right address, welcome. And yes, Python is an excellent language with which to learn progr

Re: [Tutor] Error: 'IndexedVar' object is not callable

2016-09-09 Thread Alan Gauld via Tutor
On 09/09/16 19:50, Pooja Bhalode wrote: > I was getting this error which read ' 'IndexedVar' object is not callable ' > for a variable type. Python error messages are very informative, but only if we can see them. Please post the entire error message not just a summary. > The variable is defined

Re: [Tutor] Error: 'IndexedVar' object is not callable

2016-09-10 Thread Alan Gauld via Tutor
On 10/09/16 17:23, Pooja Bhalode wrote: > I am trying to run Pyomo environment in Python on sublime text editor. OK, For the pyomo stuff you should ask on the pyomo support site (or I notice they do staxck overflow too) > Python version of 2.7.11. I am running the code in sublime itself. You ma

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 Alan Gauld via Tutor
On 13/09/16 21:11, Glen Reytas wrote: > I have a basic knowledge in Python and I would like to enhance it by > engaging in a payroll project. For you to gauge my coding level, I finished > the Python course at codecademy.com but it was 2-3 years ago. Since then I > haven't coded aside from HTML.

Re: [Tutor] awk like functionality in python

2016-09-14 Thread Alan Gauld via Tutor
On 13/09/16 18:27, Ron Williams wrote: > Hello, this is my first post. I'm glad a place like this exists. I'm coming > from primarily a shell scripting background and it was suggested I should > learn python because the two are closely related. Its often been said but its not strictly true. Python

Re: [Tutor] awk like functionality in python

2016-09-14 Thread Alan Gauld via Tutor
On 14/09/16 11:02, Alan Gauld via Tutor wrote: > - fileinput lets you process all files in a sub-directory tree. Duh, no it doesn't. It processes all the files in a list of filenames. Apologies. Correct usage is demonstrated below... > But using fileinput makes it slightly sim

Re: [Tutor] Help with Max Number and Min number script

2016-09-17 Thread Alan Gauld via Tutor
On 17/09/16 00:08, Sharon Wallace wrote: > inp = raw_input > largest = None > smallest = None > > while True: > num = raw_input('Enter a number: ') > if num = 'done' : break > print num > try : > num = float(inp)

Re: [Tutor] Help with Max Number and Min number script

2016-09-18 Thread Alan Gauld via Tutor
On 17/09/16 00:08, Sharon Wallace wrote: > largest = None > smallest = None > > while True: > num = raw_input('Enter a number: ') > if num = 'done' : break should use == to test equality a single = is an assignment and would give an error here print num try :

[Tutor] Testing tutor list server

2016-09-20 Thread Alan Gauld via Tutor
Just checkin' -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos ___ Tutor maillist - Tutor@python.org To

Re: [Tutor] Python IDLE for Windows 10, 64-bit

2016-09-21 Thread Alan Gauld via Tutor
On 21/09/16 16:14, Aaron Rose wrote: > Hi, I'm looking for a link for Python IDLE for Windows 10, 64-bit. On Windows it is usually installed by default at: %PYTHONDIR%/Lib/idelib/idle.bat Where %PYTHONDIR% is the folder where you installed Python. Create a shortcut to that and you should be g

Re: [Tutor] help with Numpy

2016-09-21 Thread Alan Gauld via Tutor
On 21/09/16 15:53, Paul Dentinger wrote: > Hello, > Sorry for such a basic question, but I am trying to get Numpy to work. I > have python 3.5 and working in IDLE. I need Numpy and Scipy and may need > matplotlib. To be honest while you can install all the bits separately I normally recommend j

Re: [Tutor] Array of Tkinter objects?

2016-09-25 Thread Alan Gauld via Tutor
On 22/09/16 15:58, Albert-Jan Roskam wrote: > I have created a grid of Tkinter Entry object The Tix module has a grid object - but its terribly documented and I couldn't get it to work properly. But then I didn't have much motive to try, you might fare better... Alternatively I think the PMW wi

Re: [Tutor] python coding problem

2016-09-26 Thread Alan Gauld via Tutor
On 26/09/16 16:35, Richard Koeman wrote: > The function prints the first two print statements then nothing else > happens. > > def maximum(n1, n2): > print "the first number is" ,n1 > print "the second number is", n2 We know this works so far, so that's fine. > if n1 > n2: > return B

Re: [Tutor] CSR generation script

2016-09-26 Thread Alan Gauld via Tutor
On 23/09/16 23:12, Srinivas Naga Kotaru (skotaru) wrote: > I am using pyOpenSSL module to automate CSR generation. Don't assume we know what that means. I know what pyOpenSSL is, but have no idea what CSR means to you. (To me it means Customer Service Representative!) > Not much self-explanatory

Re: [Tutor] Help!!

2016-09-27 Thread Alan Gauld via Tutor
On 26/09/16 23:50, Shooby Herrmann wrote: > I am using JES. I've never heard of JES and know nothing about it. Fortunately it doesn't look like this problem has much to do with JES so that's not a problem this time... However in future when you submit a question (whether on this list or anywhe

Re: [Tutor] NumPy and SciPy

2016-09-27 Thread Alan Gauld via Tutor
On 27/09/16 16:23, Floeck, Thomas wrote: > you have an idea where I can find NumPy and SciPy windows *.exe-files for > Python 3.5? I'm not sure if they are up to 3.5 yet or not but the easiest way is just to grab a full distro such as Anaconda or Canopy. Google is your friend. -- Alan G Autho

Re: [Tutor] Google is not your friend

2016-09-28 Thread Alan Gauld via Tutor
On 28/09/16 01:25, Ben Finney wrote: > Alan Gauld via Tutor writes: > >> I'm not sure if they are up to 3.5 yet or not but the easiest way is >> just to grab a full distro such as Anaconda or Canopy. Google is your >> friend. > > I do wish that meme would di

Re: [Tutor] Passing functions as arguments to other functions

2016-09-30 Thread Alan Gauld via Tutor
On 30/09/16 03:43, boB Stepp wrote: > Also, I note that if I just type a function name without the > parentheses in the interpreter, I will get something like this: > def f(): >pass > f > > > So the impression I am getting is that a function name by itself (with > no pare

Re: [Tutor] Testing print

2016-10-01 Thread Alan Gauld via Tutor
On 01/10/16 05:24, boB Stepp wrote: > === > '''Exerise 3.1 from "Think Python 2" by Allen Downey. > > This module will take a string and right justify it so that the last character > of the line will fall in column 70 of

Re: [Tutor] Testing print

2016-10-01 Thread Alan Gauld via Tutor
On 01/10/16 16:12, boB Stepp wrote: >>> This module will take a string and right justify it so that the last >>> character >>> of the line will fall in column 70 of the display. The results will be >>> printed to stdout.''' >>> >> Do you need print_msgs()? >> Won't it work the same with >> >>

Re: [Tutor] receiving regular expression from command line

2016-10-01 Thread Alan Gauld via Tutor
On 01/10/16 09:16, anish singh wrote: > I am trying to implement grep to just increase my knowledge > about regular expression. > > Below is the program usage: > python test.py -i Documents/linux/linux/ -s '\w+_readalarm*' > > However, due to my lack of knowledge about string handling > in python

Re: [Tutor] Testing print

2016-10-01 Thread Alan Gauld via Tutor
On 01/10/16 23:08, boB Stepp wrote: > On Sat, Oct 1, 2016 at 11:35 AM, Alan Gauld via Tutor > wrote: > >> ... Personally I don't like functions that >> sometimes return one and sometimes two results. I'd rather >> you returned a None first argument in th

Re: [Tutor] Testing print

2016-10-02 Thread Alan Gauld via Tutor
On 02/10/16 02:46, boB Stepp wrote: >> case. If I know that the result is always an int I can >> use the first case if I know its always a tuple I can >> use the second. But not knowing which is just plain >> messy. > > So in which sorts of scenarios would you use argument unpacking? Any time a

Re: [Tutor] Tutor Digest, Vol 152, Issue 3

2016-10-02 Thread Alan Gauld via Tutor
On 02/10/16 03:50, anish singh wrote: >> Possibly, but we can't tell because >> a) You don't show us the code that parses your input Thanks, that helps. > import os, sys, getopt > import re > import glob > > > def get_full_path(path, pattern): > for (dirpath, dirnames, filenames) in os.walk(

Re: [Tutor] How to test a function which runs a passed in function twice?

2016-10-02 Thread Alan Gauld via Tutor
On 02/10/16 23:47, boB Stepp wrote: > In exercise 3.2 of Downey's "Think Python 2" he has a function: > > def do_twice(f): > f() > f() > > As you know, I am trying to learn testing/TDD while doing these > exercises. How do I test such a *general* function? You are testing do_twice() no

Re: [Tutor] How to test a function which runs a passed in function twice?

2016-10-02 Thread Alan Gauld via Tutor
On 02/10/16 23:47, boB Stepp wrote: > adequately testing it. I cannot even conceive of what might be edge > cases for this function. I meant to add, the obvious boundaries for this actual function are passing in non-callable values, or callables that require arguments. And to handle those you

Re: [Tutor] Need help

2016-10-03 Thread Alan Gauld via Tutor
On 03/10/16 10:54, niraj pandey wrote: > I want to add every lebels value here (ie fetch from DB and display in > front of every lebel or I had store every lable value in variable and > display here). You need to tell us which OS, Python version and GUI toolkit you are using. > [image: Inline im

Re: [Tutor] please help me modify this code so that I can utilize raw_input

2016-10-04 Thread Alan Gauld via Tutor
On 04/10/16 15:04, Richard Koeman wrote: > I would like to modify this code so that instead of me calling the function > with the list as shown [1,2,3,4], the user inputs the list with raw_input. > You don't need to modify your code you just need ton write a function that reads a list from the us

Re: [Tutor] xpath - html entities issue -- &

2016-10-04 Thread Alan Gauld via Tutor
On 04/10/16 15:02, bruce wrote: > I did a quick replace ('&','&') and it replaced the '&' as desired. > So the content only had '&' in it.. You are preonbably better using your parseers escape/unescape facilities. Simple string replacement is notioriously hard to get right. > I can provide a mor

Re: [Tutor] Error

2016-10-04 Thread Alan Gauld via Tutor
On 04/10/16 18:41, Agnieszka Socha wrote: > I began to learn Python and after saving a file gra.py tried to reopen it > and got an error (in the Annex). This is a text only list so attachments tend to get stripped off. We need a lot more information I'm afraid. What are you using to "reopen" the

Re: [Tutor] remove ^ in field

2016-10-05 Thread Alan Gauld via Tutor
On 04/10/16 20:14, PERRAS Pierre wrote: > Hi, > > Sending lab result in HL7. You need to give us much more information. Do not assume we know what HL7 is, I certainly don't. Also this is a text list and attachments are usually stripped off, so if you sent something it didn't get through. > In t

Re: [Tutor] Help regarding reg exp.

2016-10-05 Thread Alan Gauld via Tutor
On 05/10/16 10:03, rakesh sharma wrote: > Hi all > > I have a string of pattern ({A,BC},{(A,B),(B,C)(C,A)}. I'm not sure what you mean, can you send some real examples of the data rather than just a generic pattern? For example what do A,B and C signify? Are they literals? Are they uppercase le

Re: [Tutor] Python Word Problems(Student)

2016-10-06 Thread Alan Gauld via Tutor
On 06/10/16 15:15, Zeel Solanki wrote: > def filter_long_words(words, n): > for x in words.split(): > return filter(lambda x: len(x) > n, words) You are trying to be too clever here, you don't need the loop. words is the original string so your filter will only receive the full string each

Re: [Tutor] Python Word Problems(Student)

2016-10-06 Thread Alan Gauld via Tutor
On 06/10/16 17:50, Alan Gauld via Tutor wrote: > Nowadays this would more commonly be done using a list > comprehension rather than reduce. Sorry, I meant filter() not reduce(). -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan

Re: [Tutor] (no subject)

2016-10-06 Thread Alan Gauld via Tutor
On 06/10/16 23:16, Zeel Solanki wrote: > HelloI just started using python and my teacher has given us some problem > to solve and I am having some problem soving the question below. I have > written some part of the code already, so can u please correct the code for > me to make it work. Please and

Re: [Tutor] (no subject)

2016-10-06 Thread Alan Gauld via Tutor
On 06/10/16 23:16, Zeel Solanki wrote: > HelloI just started using python and my teacher has given us some problem I just noticed that you are the same person who posted earlier. The replies you have already received should answer your questions. Please don't start a second thread with the same s

Re: [Tutor] TDD: How to test input()?

2016-10-08 Thread Alan Gauld via Tutor
On 08/10/16 07:18, Steven D'Aprano wrote: > Testing code that depends on user input is always tricky. There are a > few ways to deal with it: > > (5) Or you could manually monkey-patch sys.stdin as you do. A variation on this that I have used is to read the input from stdin as usual but redirec

Re: [Tutor] Python Shell

2016-10-09 Thread Alan Gauld via Tutor
On 08/10/16 20:43, Alan Clarke wrote: > I created a program called HW.py that runs under a command prompt, > but Python Shell gives the following error: How are you running it in the Python shell? > Traceback (most recent call last): > File "", line 1, in > HW.py > NameError: name 'HW'

Re: [Tutor] Decrypting a Password

2016-10-09 Thread Alan Gauld via Tutor
On 09/10/16 01:50, Linda Gray wrote: > I am working on a homework assignment that has me creating a password saver > using a ceasar cipher code. I was provided the key to the cipher and two > passwords. I need to look up and decrypt the passwords Are you sure? That's very bad practice and neve

Re: [Tutor] Decrypting a Password

2016-10-09 Thread Alan Gauld via Tutor
On 09/10/16 10:42, Steven D'Aprano wrote: >> Are you sure? That's very bad practice and never needed >> in the real world. > > You've never used a password vault then? That's true, I've never seen a secure one, so I never use them. Same with browsers doing auto-authentication, a terrible idea!

Re: [Tutor] Python dependencies in Anaconda

2016-10-11 Thread Alan Gauld via Tutor
On 10/10/16 16:54, David Wolfe wrote: > Anaconda (using Spyder or a Juypter notebook), so the dependencies are > included, so it's not an issue. So, what I'm wondering is, are the > dependencies that are included in Anaconda just contained in Anaconda, and > not actually accessible in Python, An

Re: [Tutor] Advise with coding

2016-10-11 Thread Alan Gauld via Tutor
On 11/10/16 10:16, tracey jones-Francis wrote: > Is it possible someone on here can advise me where I am going wrong. Yesm, thats what this list is for but... We need to see code - we can't guess what you did. We need to know what input you used, what output you got and why its not what you expec

Re: [Tutor] Python Code Not Working

2016-10-11 Thread Alan Gauld via Tutor
On 09/10/16 21:39, jeremygaine...@gmail.com wrote: > Everytime I run this it says test is not defined . I don’t understand. It means test is not defined - that is, Python doesn't know about it. You call a function test() but there is no such function built into Python, so it complains. Presumabl

Re: [Tutor] Cluster analysis script error

2016-10-11 Thread Alan Gauld via Tutor
On 11/10/16 22:13, Mike Armson wrote: > I am trying to run a script (attached) which determines the number of > clusters of fixations within a set of eye movement data. The script says to > enter the following command on python: > > "python fixationClusters.py outputPrefix input clusterDistance"

Re: [Tutor] Need help

2016-10-12 Thread Alan Gauld via Tutor
On 12/10/16 09:03, niraj pandey wrote: > Can you pls guide how to print this screen (Attached here) content in > printer ? As we already pointed out this is a text list so attachments are usually stripped off... However, printing from Tkinter is not easy. The simplest way is usually to create an

Re: [Tutor] Adding numbers within a string

2016-10-12 Thread Alan Gauld via Tutor
On 12/10/16 01:37, LQ Soh wrote: > To whom it may concern, > Can someone enlighten me as to how you can create a function such > that sum_numbers('10 5 8'), when run, will give an answer of 23, without > using str.split() and using a for loop I'm assuming this is some kind of classroom exercise? O

Re: [Tutor] Adding numbers within a string

2016-10-12 Thread Alan Gauld via Tutor
On 12/10/16 17:58, D.V.N.Sarma డి.వి.ఎన్.శర్మ wrote: > Sorry, I did not read the conditions that split and for should not be used. It is even more confusing - split() may NOT be used but 'for' MUST be used... -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.a

Re: [Tutor] Code for python game

2016-10-12 Thread Alan Gauld via Tutor
On 12/10/16 18:40, tracey jones-Francis wrote: > I want to have a function that will ignore certain words that > i have specified in a dictionary. > the dictionary is called skip_words and has about 20 different strings in. We shouldn't care inside the function what the external data is called,

Re: [Tutor] Python help

2016-10-16 Thread Alan Gauld via Tutor
On 15/10/16 23:48, Nicholas Hopkins wrote: > Please tell me what is wrong with my code and how I can put an if else > statement > inside of another if else statement You are almost right but... > This is my code: > path = input('Which path number will you take?') > if path == '1': >

Re: [Tutor] Python Easy Word Problem (Grade 11)

2016-10-18 Thread Alan Gauld via Tutor
On 18/10/16 02:31, Zeel Solanki wrote: > I just recently started learning python and I am having trouble figure out > the following python problem. Can you please help me make the code for the > the problem below: We will help, but we won;t do the lesson for you. You will need to wr4ite the code.

Re: [Tutor] selenium bindings...

2016-10-18 Thread Alan Gauld via Tutor
On 18/10/16 18:00, bruce wrote: > This is prob way off topic. Yep, more appropriate for a selenium group/list. There is one on gmane at gmane.comp.web.selenium.user Try asking there. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan

Re: [Tutor] Created map after opening file

2016-10-20 Thread Alan Gauld via Tutor
On 20/10/16 05:31, Betty Cruz wrote: > Hello, I'm new to python. Hello, welcome. > ...I'm trying to create a map after reading a file. What kind of "map" - that's a very generic term. Do you mean a geographic map using GIS data? If so is it some kind of image output that you want? Or is it a m

Re: [Tutor] Created map after opening file

2016-10-20 Thread Alan Gauld via Tutor
Always use Reply All (Or Reply List) to reply to the tutor list... On 20/10/16 14:45, Betty Cruz wrote: > I had actually attached the map and how the data looked. I guess the > pictures didn't go through? I have added links. > The server often strips attachments, it's always better to include as

Re: [Tutor] Help please

2016-10-20 Thread Alan Gauld via Tutor
On 20/10/16 21:25, Karen Palladino wrote: > I am new to python and programming for that matter. Basically, I don't know > much at all. I have python on my p/c which was put there by a former > co-worker who wrote a program that extracts bites of information to generate > a report. The format of th

Re: [Tutor] Python

2016-10-24 Thread Alan Gauld via Tutor
On 24/10/16 15:40, Kadir Sertcanli wrote: > Hi! I have a function that I want to plot depending on a parameter (’a’), OK, But you will need to give us some more details. > I looked in the beginners guide Which beginner's guide are you using? Plotting is not something normally covered in a Pyth

Re: [Tutor] Python v3 Tkinter GUI program

2016-10-24 Thread Alan Gauld via Tutor
On 24/10/16 22:36, Elliott Andrews wrote: > Hi there, I am making a program in python based on a Subway operation. All > descriptions and comments codes are provided in the attached program. Normally attachments are deleted by the server although yours seems to have gotten through (to me at least)

Re: [Tutor] Python v3 Tkinter GUI program

2016-10-24 Thread Alan Gauld via Tutor
On 24/10/16 22:36, Elliott Andrews wrote: > Sorry is this sounds really broad, and I am happy to clarify and points. Sorry I just noticed another point that I can't overlook. You have code/comment: root = Tk() #The actual statment which opens the window, toplevel = root.winfo_to

Re: [Tutor] Attaching program text to messages

2016-10-24 Thread Alan Gauld via Tutor
On 25/10/16 00:01, Ben Finney wrote: > I think because it is (declared by Elliott's mail user-agent to be) a > text attachment, it survives to the mailing list. That might be the reason. > A text attachment (provided you ensure it is declared that way, as > Elliott's message did) seems a better

Re: [Tutor] Alternative to for/while loop

2016-10-25 Thread Alan Gauld via Tutor
On 25/10/16 02:38, Bryon Adams wrote: > question. The book I'm working through hasn't covered using flow control > yet so I'm thinking there should be a way to do this without the for > loop I used, but I'm at a loss here. Thee are ways to do it without using a for loop but they are all more a

Re: [Tutor] Alternative to for/while loop

2016-10-25 Thread Alan Gauld via Tutor
On 25/10/16 09:09, niraj pandey wrote: > Try this. > > my_string = '0,1,2,3' > my_lst=my_string.split(",") > leng = len(my_lst) > b=sum(my_lst) > avg=float(b/leng) > print avg It doesn't work because my_list is a list of strings and you can't sum() strings. The loop is needed to convert the strin

Re: [Tutor] Alternative to for/while loop

2016-10-25 Thread Alan Gauld via Tutor
On 25/10/16 09:31, Wolfgang Maier wrote: > A possible explanation is that, as you are saying, the book uses > python2. In python2, input does not return a string, but evaluates the > input from the user to produce different types of objects. So in Python2: Good catch Wolfgang, that's probably w

Re: [Tutor] What is wrong with my Python program that causes it to run but not give results?

2016-10-25 Thread Alan Gauld via Tutor
On 25/10/16 20:24, Ed Troy wrote: > my Ubuntu machine. I created the diode IV curve data as per the article, > but I can't seem to get it to run. > edward@ubuntu:~$ python LED_model_utf8.py LED_IV.txt > Traceback (most recent call last): >File "LED_model_utf8.py", line 4, in > import m

Re: [Tutor] What is wrong with my Python program that causes it to run but not give results?

2016-10-26 Thread Alan Gauld via Tutor
On 26/10/16 04:19, Ed Troy wrote: > I am pretty sure I installed python3. And, also, matplotlib, scipy, and > numpy. If I enter either python or python3, I get the >>> prompt, so I > may have both installed. Yes, that's normal. Ubuntu uses python 2 for some of its utilities. > How do I verify

Re: [Tutor] String within a string solution (newbie question)

2016-10-26 Thread Alan Gauld via Tutor
On 26/10/16 19:06, Wish Dokta wrote: > folders with a drive/directory. To do this I am storing each directory in a > dict as the key, with the value being the sum of the size of all files in > that directories (but not directories). > > For example: > > for "C:\\docs\\code" in key: > > Which wo

Re: [Tutor] New to Python

2016-10-27 Thread Alan Gauld via Tutor
On 27/10/16 23:41, Rusty Bayles wrote: > I just installed 3.5.2 interpreter and cannot figure out how to run > program. I strongly suggest you go to Youtube and search for IDLE. There are several short (3-10min) videos there that should make it clear where you are going wrong. Watch a couple

Re: [Tutor] New to Python

2016-10-27 Thread Alan Gauld via Tutor
On 28/10/16 01:05, Rusty Bayles wrote: > Thanks for the reply Alan, > Could you please tell me more detail on the videos? Like who made them. Some are just amateurs others are professional (or at least Youtube regulars) Here are a couple of links, but to be honest just about any of them would mee

Re: [Tutor] Assessing local variable outside function

2016-10-28 Thread Alan Gauld via Tutor
On 28/10/16 02:38, nils wagenaar wrote: > Hello, > > > Could i use a variable defined in a function in another function? By returning it to the caller. > def DatasetToSubset(file, LatUpbound, LatLowBound, LonUpBound, LonLowBound): > nc=netCDF4.Dataset(file) > lats=nc.variables['lat'][

Re: [Tutor] why it is showing attribute error in line7

2016-10-29 Thread Alan Gauld via Tutor
Please always post the full error text in future. Meanwhile I'll guess: On 29/10/16 05:42, SONU KUMAR wrote: > fname = raw_input("Enter file name: ") > if len(fname) < 1 : fname = "mbox-short.txt" > fh = open(fname) > count = 0 > for line in fh: >line=line.rstrip missing parens means you re

Re: [Tutor] looking for image library based on PIL Image

2016-10-30 Thread Alan Gauld via Tutor
On 30/10/16 15:32, Benjamin Fishbein wrote: > I’m trying to automate a lot of images using PIL’s Image library, > but I don’t want to write all the filters and manipulation > algorithms myself. Do you know of any good code that people > have written that does this? It depends on what kind of imag

Re: [Tutor] implementing sed - termination error

2016-11-01 Thread Alan Gauld via Tutor
On 02/11/16 00:18, bruce wrote: > Trying to do a search/replace over a file, for a given string, and > replacing the string with a chunk of text that has multiple lines. > > From the cmdline, using sed, no prob. however, implementing sed, runs > into issues, that result in a "termination error"

Re: [Tutor] Python code

2016-11-01 Thread Alan Gauld via Tutor
On 01/11/16 21:28, Haley Sandherr wrote: > Hello, I am new to python and need help with this question: What kind of help? What exactly do you find difficult? > > Compose a function odd ( ) Can you define a function? Any function? > that takes three bool arguments Can you define a function th

Re: [Tutor] Module webbrowser.os

2016-11-02 Thread Alan Gauld via Tutor
On 02/11/16 06:44, Palanikumar Gopalakrishnan wrote: > After that i want to experiment with webbrowser.os module, But dont know > how to execute it. webbrowser.os seems to just be a link to the standard os module. So you should read the docs for os...and use the os module directly. > So I use di

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