Re: [Tutor] input string to own console stdin

2017-11-15 Thread Alan Gauld via Tutor
On 15/11/17 22:16, Eddio 0141 wrote: > Hi. > I've been searching on google about inputting to own stdin and press enter > but so far i haven't found anything at all. You need to give us a bit more context. This doesn't look like standard library stuff so which package are you using? (Is that what

[Tutor] Updates to web tutor

2017-11-15 Thread Alan Gauld via Tutor
Only just on topic but i'd like some help please... I've been doing some much needed maintenance to my web tutor. In particular I'm trying to move it from the (web)stone age of HTML3 and Frames to HTML5/CSS and provide a responsive/reactive design. Along the way I've also completely changed the

[Tutor] Fwd: Re: (no subject)

2017-11-12 Thread Alan Gauld via Tutor
Forwarding to the list... From: RRRoy BBBean <rrroybbb...@gmail.com> Organisation: DDDead MMMail To: Alan Gauld <alan.ga...@yahoo.co.uk>, tutor@python.org On Sun, 2017-11-12 at 23:06 +, Alan Gauld via Tutor wrote: > On 12/11/17 15:54, 劉權陞 wrote

Re: [Tutor] (no subject)

2017-11-12 Thread Alan Gauld via Tutor
On 12/11/17 15:54, 劉權陞 wrote: > 我在使用closure 時,遇到了一些問題。 > 例如一個簡單的例子, > > def f1(a): > def f2(b): > return a+b > return f2 > > f1=f1(10) > > 這時f1會發生衝突 ,這是正常的嗎? Can you tell us what language this is? Or better still post an English translation? That's what most of us speak on this

Re: [Tutor] double ended queue

2017-11-05 Thread Alan Gauld via Tutor
On 05/11/17 15:05, Atux Atux wrote: > ok then. how do i link 'r' to remove an item from right with mylist.pop(0) > and how can i remove an item from left with '0r'? Same way you detected the 'q' to quit. Using a variation of the 'code' I sent earlier: response = input().lower() # allow user

Re: [Tutor] double ended queue

2017-11-04 Thread Alan Gauld via Tutor
On 04/11/17 20:11, Atux Atux wrote: > i am new to the area and i am struggling with a small project that i have. You are on the right path. When faced with any software project you have to keep breaking it down till you get to something you can write. You've made a start, lets see what else

Re: [Tutor] missing idlelib and pip

2017-11-01 Thread Alan Gauld via Tutor
On 01/11/17 17:57, Paul Simon wrote: > Thank you all very much. All is working fine now. I had always assumed > that Idle and pip were installed with the standard library and not have > to be separately installed. The Linux philosophy is that the user gets to choose so there should be no

Re: [Tutor] missing idlelib and pip

2017-11-01 Thread Alan Gauld via Tutor
On 01/11/17 16:08, Mats Wichmann wrote: > changed away, that means you would search using urpmi... If it uses RPM packages then there should definitely be Python and Tkinter packages available. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/

Re: [Tutor] Help regarding creating tags

2017-11-01 Thread Alan Gauld via Tutor
On 01/11/17 06:02, Hemant Sain wrote: > i want to tag categories to its menuname. Your description below does not explain how you will tag them together, you simply identify which menu items have a category, but no way to determine which category goes with which menu item? > i have a csv

Re: [Tutor] missing idlelib and pip

2017-11-01 Thread Alan Gauld via Tutor
On 01/11/17 04:30, Paul Simon wrote: > The python distribution for the Mageia 6 update does not include idlelib > or pip. Please tell me where to find them to add. IDLE should be in your package manager - along with zillions of other Python packages. You should just need to select it and

Re: [Tutor] Help with python 2.7

2017-10-30 Thread Alan Gauld via Tutor
On 30/10/17 21:02, Alchemy wrote: > I’m stuck on the homework ,butmore importantly stuck on the concepts behind > the homework. > > Can your orginazation help? Yes, we are happy to help with homework although we won't usually give you the full answer. We will make suggestions and are happy to

Re: [Tutor] confused about Pypi

2017-10-28 Thread Alan Gauld via Tutor
On 28/10/17 21:43, Mark Anderson wrote: > As I understand it I have to write certain text into > the command prompt Please note that this is probably the OS command prompt (a CMD window in windows - C:\WINDOWS> or similar) not the Python interpreter (which looks like >>>) > It tells me that

Re: [Tutor] howto install a "curses" lib on win7

2017-10-28 Thread Alan Gauld via Tutor
On 28/10/17 06:10, eMyListsDDg wrote: > on Win7 how can i get a 'curses' lib installed so this script runs? Do a Google search for windows curses, there are at least a couple of options. I've no experience of how well they work however because... ...as a last resort, install cygwin and use the

Re: [Tutor] problem with program in python in easy steps

2017-10-26 Thread Alan Gauld via Tutor
On 26/10/17 21:02, Chris Coleman wrote: > i wrote these programs and saved them per instructions on page 128 and 129 > in the book "python in easy steps". I don't know the book but... > > class Person: > '''A base class to define Person properties.''' > def__init__(self,name): >

Re: [Tutor] Not able to import Tensorflow in python script

2017-10-25 Thread Alan Gauld via Tutor
On 25/10/17 19:24, shubham goyal wrote: > I was trying to run this check script of tensorflow after installing the > tensorflow successfully. Its not part of the standard library so I'll need to assume you are correct and it installed correctly. However from some of the errors below it looks as

Re: [Tutor] Coding question: How to call a function when the function is assigned a variable

2017-10-23 Thread Alan Gauld via Tutor
On 23/10/17 01:40, Historitical Show wrote: > Here is what I have so far: > > import time > coins = 0 > score = 0 > cptype = 1 > start = time.time() > end = time.time() Note that you are setting start and end to almost identical times and never change then later. > def main(): > global

Re: [Tutor] How to test for the existence of a table in a sqlite3 db?

2017-10-19 Thread Alan Gauld via Tutor
On 18/10/17 21:09, Albert-Jan Roskam wrote: > > On Oct 16, 2017 15:12, Neil Cerutti wrote: >> sqlite3 module. In sqlite modifying table definitions is limited >> to the simple addition of a new row of data. > > Really? How so? I used ALTER TABLE ADD COLUMN the other day,

Re: [Tutor] problems using a listbox

2017-10-17 Thread Alan Gauld via Tutor
On 17/10/17 07:25, Chris Roy-Smith wrote: > I am trying to learn how to use a tkinter listbox. When I execute my > experimental code, an odd index is printed immediately (output below > code), index looks wrong (shouldn’t it be an integer). You pass in the widget so thats what gets printed

Re: [Tutor] Windows Memory Basics

2017-10-17 Thread Alan Gauld via Tutor
On 17/10/17 01:02, Michael C wrote: > that is, one number, can be truncated and exist in multiple locations like > this > > double = 12345678 > > 123 is at x001 > 45 is at x005 > 678 is at x010 That won't happen, a single variable will always be in a a single area. But the representation

Re: [Tutor] Windows Memory Basics

2017-10-17 Thread Alan Gauld via Tutor
On 17/10/17 00:53, Michael C wrote: > ah, i am bummed completely haha. > > Is there a way to tell which parts a variables so I can scan it? > Maybe you could point me to some reading materials? There are some rules about where programs store data within their memory space, but typically that

Re: [Tutor] Windows Memory Basics

2017-10-16 Thread Alan Gauld via Tutor
On 16/10/17 21:04, Michael C wrote: > I don't understand this part about the memory: And I'm not sure I understand your question but... > if I used VirtualQueryEx to find out if a region of memory is ok to scan, > and it > says it's ok, are the values in the region arranged like this: > >

Re: [Tutor] Tree again: iterator, yield, increase (treelib)

2017-10-14 Thread Alan Gauld via Tutor
On 14/10/17 16:44, Chris wrote: > I've a question about treelib library from pip. The list focus is the language and standard library so if you want to ask about other code you need to give us more context. treelib is not a commonly discussed module, in fact this the first mention I've seen. >

Re: [Tutor] How to test for the existence of a table in a sqlite3 db?

2017-10-14 Thread Alan Gauld via Tutor
On 14/10/17 06:43, boB Stepp wrote: > table if that table does not exist. Alan suggested using > executescript() to do this. I misunderstood Alan and thought that > this would take a filename and execute it. c.executescript(sqlFile.read()) -- Alan G Author of the Learn to Program web site

Re: [Tutor] problem with program

2017-10-13 Thread Alan Gauld via Tutor
On 13/10/17 18:53, Alan Gauld via Tutor wrote: > On 13/10/17 13:04, Chris Coleman wrote: > >> def_init_(self,chat): > >> File "scripts/bird.py", line 4 >> def_init_(self,chat): >> ^ >> SyntaxError: invalid

Re: [Tutor] problem with program

2017-10-13 Thread Alan Gauld via Tutor
On 13/10/17 13:04, Chris Coleman wrote: > def_init_(self,chat): > File "scripts/bird.py", line 4 > def_init_(self,chat): > ^ > SyntaxError: invalid syntax There are two problems here. The first is that you need a space after the def. The second is that

Re: [Tutor] using while loop for read process memory

2017-10-13 Thread Alan Gauld via Tutor
On 13/10/17 02:58, Michael C wrote: >         end = current_address + mbi.RegionSize - 7 > > then it doesn't complain anymore. I think it's because I ran this in a > while loop with start += 1 > so in the last 7 bytes, I'd be reading past the end of this memory chunk. > > Is this right? Yes,

Re: [Tutor] Variable list problem

2017-10-12 Thread Alan Gauld via Tutor
On 12/10/17 22:29, Le Mar wrote: > hi i'm wondering if anyone could help me with this exercise: > We can give you tips but we don;t do your homework for you. > 1. Read an integer number from the console, store the result in a variable > n > 2. Read ‘n’ integers from the console and store

Re: [Tutor] sibling import

2017-10-12 Thread Alan Gauld via Tutor
On 12/10/17 12:15, Atar new wrote: > Here is my problem. I want to use sibling import but it is not working . I > know taht if we add the directory in sys.path ,it will work. > Why not put the package in the same folder as your top level script? I think that should work. > But I have to

Re: [Tutor] using while loop for read process memory

2017-10-08 Thread Alan Gauld via Tutor
On 08/10/17 20:18, Michael C wrote: > This is the red part  >   index = current_address >         end = current_address + mbi.RegionSize > >         while index < end: >             if ReadProcessMemory(Process, index, ctypes.byref(buffer), \ >                                  

Re: [Tutor] Tkinter's Documentation

2017-10-06 Thread Alan Gauld via Tutor
advise whether it's something you can do, or something that can be changed in Tkinter or something you need to talk to the Tcl/Tk developers about. Alan g. -- From: Alan Gauld <alan.ga...@yahoo.co.uk>

Re: [Tutor] Tkinter's Documentation

2017-10-06 Thread Alan Gauld via Tutor
ject, for this reason why I asked for an alternative. Sorry if my first message was not so clear -- From: Tutor <tutor-bounces+rikudou__sennin=outlook@python.org> on behalf of Alan Gauld

Re: [Tutor] script guidelines

2017-10-06 Thread Alan Gauld via Tutor
On 06/10/17 11:07, renukesh nk wrote: > currently m using pycharm , interpreter = python 3.6 > i am getting th error as below, what might be the reason for this. > > UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 159: > character maps to It looks like you have a

Re: [Tutor] Tkinter's Documentation

2017-10-06 Thread Alan Gauld via Tutor
On 05/10/17 17:38, adil gourinda wrote: > Where can i find the reference documentation of "Tkinter" Tkinter is a module, not part of the language, so it is documented in the modules section. But the documentation is not 100% complete and for details you often need to look at the Tk/Tcl

Re: [Tutor] I am trying to create a list of object and want to display that list on the screen on my Tkinter screen

2017-10-04 Thread Alan Gauld via Tutor
On 04/10/17 14:40, edmundo pierre via Tutor wrote: > Hello, > I am writing a code When posting code please use plain text. HTML gets mangled so we can't see what your code looks like.(see below) > where I am using a empty list and I will fill up that > list with object. Then  I will show those

Re: [Tutor] ctypes wintypes

2017-10-04 Thread Alan Gauld via Tutor
On 04/10/17 04:12, Michael C wrote: > Is there a module that does this for me? > If it exists, how do I find it? Google is your friend. What you need to remember is that modules only get created if someone else has the same need as you. And usually if its a repeated need since it takes time and

Re: [Tutor] (no subject)

2017-10-03 Thread Alan Gauld via Tutor
On 03/10/17 22:49, steve.lett...@gmail.com wrote: > That is guessesTaken. It reads 0 when it should be a larger number. What makes you think so? You never increase it from its initial value so, quite correctly it stays at zero. > I am a beginner having another try to get it! Remember the

Re: [Tutor] ctypes wintypes

2017-10-03 Thread Alan Gauld via Tutor
On 03/10/17 22:30, Michael C wrote: > I am trying to create SYSTEM_INFO structure and MEMORY_BASIC_INFORMATION > structure > > I think there are modules for this purpose? Is it the ctypes.wintypes? wintypes does define many of the standard Win32 API types but sadly neither of the two you

Re: [Tutor] script guidelines

2017-10-03 Thread Alan Gauld via Tutor
On 03/10/17 09:48, renukesh nk wrote: > requirement: > i have a directory , that contains multiple sub directories, each sub > directory has multiple text and log files, my script fetches the required > lines from all the sub directories and stores it in one text file. > I'm not too sure what

Re: [Tutor] closing the window through code

2017-10-01 Thread Alan Gauld via Tutor
On 01/10/17 19:36, Max Patient wrote: > my task is to create a password checker and one of the > criteria is to have a quit option. What does the quit do? Quit the login? or quit the application? Based on your subject line I'm assuming just quit the login - but then how would you do anything

Re: [Tutor] Am I missing something obvious about "FizzBuzz"?

2017-10-01 Thread Alan Gauld via Tutor
On 01/10/17 22:39, Marc Tompkins wrote: >>> Probably the best programming test there is look at code >>> that's already been developed, >> >> It is what we did with the bug finding test. > My test was, fortunately for me, not a start-from-scratch FizzBuzz problem, > but debugging a report

Re: [Tutor] Am I missing something obvious about "FizzBuzz"?

2017-10-01 Thread Alan Gauld via Tutor
On 01/10/17 16:09, Steven D'Aprano wrote: >> The fizzbuzz one is definitely a bit too simplistic, but the one >> cited by McConnel (reverse a linked list in C) is typical of >> the kind of question we used. And yes, most candidates failed. > > I would have *no idea* how to traverse a

Re: [Tutor] Most common words in a text file

2017-10-01 Thread Alan Gauld via Tutor
On 30/09/17 18:12, Sri G. wrote: > import sysimport collections I assume that should be two lines? But you can also import multiple modules on a single line. import sys, collections Although some folks don't like that style. > def find_most_common_words(textfile, top=10): > ''' Returns

Re: [Tutor] Beginner's guessing game

2017-10-01 Thread Alan Gauld via Tutor
On 01/10/17 09:38, Steve Lett wrote: > Can u please tell me why this program does not work in line 28? That is > guessesTaken. It reads 0 when it should be a larger number. > > I am a beginner having another try to get it! > > Thank you, Steve Welcome Steve, but I can't see any program? Did

Re: [Tutor] Am I missing something obvious about "FizzBuzz"?

2017-10-01 Thread Alan Gauld via Tutor
On 01/10/17 06:56, boB Stepp wrote: > I definitely was *not* looking for a pat on the back. I just could > not believe that "FizzBuzz" (Or similar questions.) would ever be > needed in a job interview for programming/software engineering. The fizzbuzz one is definitely a bit too simplistic,

Re: [Tutor] I want to learn how memory works!

2017-09-30 Thread Alan Gauld via Tutor
On 29/09/17 19:47, Michael C wrote: > Could you point me to a source of information about all the things someone > should know before he starts writing a memory scanner? Not a single source but wikipedia is a good start for anything technical. In particular you need to understand the

Re: [Tutor] Directory Structure

2017-09-29 Thread Alan Gauld via Tutor
On 29/09/17 20:34, Chris wrote: > I want to store some kind of representation of the tree in memory when > the code runs. Then I could not only move the mails but also create > lists, e.g. a table with mail headers. Thanks for the extra detail but... Probably the reason you can't find any

Re: [Tutor] problem with python3.5 headfirst python 2nd ed chpt 10 test drive example decorator issues

2017-09-29 Thread Alan Gauld via Tutor
On 28/09/17 23:35, peter wrote: > I am on chapter 10 of headfirst python second edition. got most of the > prior codes to work but am stuck on this one. I don;t know the book and only vaguely know Flask, but I'd start by adding some debug print statements to the functions. Something like def

Re: [Tutor] Directory Structure

2017-09-29 Thread Alan Gauld via Tutor
On 29/09/17 18:02, Chris wrote: > I'd like to store a directory tree in a python script. That doesn't make much sense. A directory tree is stored on the hard disk. A python script is the source code to a program you execute What do you mean by "store the directory tree in the script"? Do you

Re: [Tutor] Python programming for the absolute beginner

2017-09-29 Thread Alan Gauld via Tutor
On 29/09/17 08:51, Peter Collidge wrote: > I have borrowed the above book from my local library but I believe it was > written in 2010 and as a result I am having difficulty in deciding which > version of Python to download. > Can anyone help? If you want to follow the book use the version the

Re: [Tutor] How to sort float number from big numbers to small numbers?

2017-09-25 Thread Alan Gauld via Tutor
On 25/09/17 04:34, edmundo pierre via Tutor wrote: I am trying to sort float numbers input by an user from the bigger to smaller number. I do not know how to compare float numbers. Any ideas? Thank you! The same way you sort anything else. Using the comparison operations ==, <, >, <=, >=

Re: [Tutor] running or calling a module from the desktop

2017-09-21 Thread Alan Gauld via Tutor
On 20/09/17 22:06, orpha.pen...@outlook.com wrote: > I would like to import, run or set path to desktop. OK, On Windows go to Windows Exploder and type in the address %HOMEPATH%\Desktop Go there and you should be able to see/figure out the full path to your personal desktop folder. Then add

Re: [Tutor] subprocess check_output

2017-09-20 Thread Alan Gauld via Tutor
On 20/09/17 22:09, Derek Smith wrote: > Why does python output this b and newline characters Because that's what the command is returning. The b indicates its an array of bytes (as opposed to a unicode string) Note the module dpocumentation for check_output() says: "By default, this function

Re: [Tutor] Need Help with install of Python!

2017-09-19 Thread Alan Gauld via Tutor
On 19/09/17 21:13, Larry Staley wrote: > Hello I am very new to Python just having installed Python Version 2.7 onto > my windows 8.1 laptop. I thought the install was successful and was > entering information for my first assignment when I received an unexpected > error. Where did you get your

Re: [Tutor] Tutor Digest, Vol 163, Issue 28

2017-09-19 Thread Alan Gauld via Tutor
On 19/09/17 15:45, Saahndong Ransom wrote: > What are the uses of python? > What are easy way to learn python? Python is a general purpose programming language that can be used to build many kinds of software applications from computer administration to web servers to desktop GUI applications.

Re: [Tutor] (no subject)

2017-09-19 Thread Alan Gauld via Tutor
On 19/09/17 15:11, C wrote: > Hi Python tutor, I require help for a script that asks user for number of > rows, r and number of columns c, and generates a r x c matrix with the > following values: You already posted this in another thread, please do not multi-post it just clutters up the archive

Re: [Tutor] Require help for a script

2017-09-19 Thread Alan Gauld via Tutor
On 19/09/17 08:48, Clara Chua wrote: > Hi Python tutor, I require help for a script that asks user for number of > rows, r and number of columns c, and generates a r x c matrix with the > following values: What help do you need? Which part of the above do you not know how to do? Can you ask the

Re: [Tutor] pip install of subprocess module

2017-09-18 Thread Alan Gauld via Tutor
On 18/09/17 18:59, Derek Smith wrote: > I want to use the subprocess.run module b/c per the> docs os.system is > antiquated Its not so much antiquated but it is deprecated because it is severely limited, all you get back is an error code. > Why am I doing wrong below? You are trying to

Re: [Tutor] Python HW question

2017-09-16 Thread Alan Gauld via Tutor
On 16/09/17 01:32, mikn...@gmail.com wrote: > I really need some Python help. I’m a beginner and have some hw for class: OK, Usual caveat: we don;t do your homework, just give hints. > Write a program that calculates longest substring of increasing letters in > st, say

Re: [Tutor] Python + Irc

2017-09-15 Thread Alan Gauld via Tutor
On 15/09/17 21:16, Fernando Gualberto wrote: > How i can integrate Python program with IRC to send Messages from program > to the IRC? If you google "python irc module" you should get several hits. Try looking at the documentation and pick the one that seems easiest for your needs. -- Alan G

Re: [Tutor] array input from keyboard

2017-09-15 Thread Alan Gauld via Tutor
On 15/09/17 21:50, Derek Smith wrote: > if nput1 == "file" : > nput2 = input("Please provide your input file? ") > nput2 = nput2.lower() Are you sure the filenames will always be lower case? > print (nput2) > fh = open(nput2,"r") You should wrap that in a try/except in case

Re: [Tutor] Python Help

2017-09-15 Thread Alan Gauld via Tutor
On 15/09/17 04:08, Pratyusha Thundena wrote: > How do check to see if string ‘garden’ contains a > vowel(a, e , i , o, u , or y) using a for loop? Hi, this sounds like homework and we won't do your homework for you, but we do give hints. How would you do this without a computer? There are (at

Re: [Tutor] How to write database-agnostic python code? (Is this even possible?)

2017-09-14 Thread Alan Gauld via Tutor
On 14/09/17 04:40, boB Stepp wrote: >> mapping your logic layer object models to underlying >> data tables. > > My initial thoughts here are that typically a particular class would > map to a particular table and that each object instance would > correspond to a row in said table. Is this

Re: [Tutor] How to write database-agnostic python code? (Is this even possible?)

2017-09-14 Thread Alan Gauld via Tutor
On 14/09/17 04:11, boB Stepp wrote: >> SELECT some, fields (never *) > > Why no "*"? Does this open up a security vulnerability? Not so much security as resilience to change. If you use * and the data schema changes to include extra fields then your * query returns the extra

Re: [Tutor] Create CDF using Python

2017-09-13 Thread Alan Gauld via Tutor
On 13/09/17 01:28, Pareshkumar Panchal wrote: > I have set of data in excel file. i would like to create the CDF plots & > find 40th & 70th Percentile using python with functionality of refresh > whenever the data sets update. There may be a good reason for this but frankly that's what

Re: [Tutor] How is database creation normally handled?

2017-09-13 Thread Alan Gauld via Tutor
On 10/09/17 18:41, Mats Wichmann wrote: > restore" and a local copy of the (mysql) db will be built. So that's > what I just agreed with: the setup process happens outside the code app ... > maybe it's not that unusual - any time you need to start with a > reproducible known state of the DB, that

Re: [Tutor] How to write database-agnostic python code? (Is this even possible?)

2017-09-13 Thread Alan Gauld via Tutor
On 12/09/17 20:05, boB Stepp wrote: As I continue to read about SQL, one thing jumps out: There are many differences between how SQL statements are implemented usage of SQL. So how does one write one's python program to be DB-agnostic? And if this is impossible, then what is the best way

Re: [Tutor] question about calendar module in standard libriary

2017-09-11 Thread Alan Gauld via Tutor
On 11/09/17 11:58, Айнур Зулькарнаев wrote: > So, the question is why not explicitly raise ValueError if > user enters the firstweekday parameter bigger that 6 Its a valid question but you probably need to find the original PEP document to find the answer and that module has been around for a

Re: [Tutor] How to create an object in database only if the object is not already there?

2017-09-11 Thread Alan Gauld via Tutor
On 11/09/17 10:38, GMX wrote: > I am using `pony` orm to write a simple class as my model. pony is not a standard module (indeed I only heard about it from your email) so you are probably best asking on the pony support forum if such exists or via the author. > from pony.orm import Database >

Re: [Tutor] beginning to code

2017-09-10 Thread Alan Gauld via Tutor
For some reaspon I'm missing the original post so apologies to replying to Senthil instead of the OP directly... >> The code i should try is as following: >> >> while True: >> print ('who are you') >> name = input () >> if name != 'bert': >> continue >>

Re: [Tutor] Standard module sqlite3 or APSW?

2017-09-10 Thread Alan Gauld via Tutor
On 10/09/17 01:56, boB Stepp wrote: > So if all of this is correct, does the documentation at > https://rogerbinns.github.io/apsw/pysqlite.html#pysqlitediffs give an > objective assessment of the differences between pysqlite and APSW? I believe so. I've never used APSW, only read a single web

Re: [Tutor] How is database creation normally handled?

2017-09-10 Thread Alan Gauld via Tutor
On 10/09/17 01:29, boB Stepp wrote: > While reading about SQL, SQLite and the Python module sqlite3, it > appears that I could (1) have a program check for the existence of the > program's database, and if not found, create it, make the tables, > etc.; or, (2) create the database separately and

Re: [Tutor] New to Python

2017-09-08 Thread Alan Gauld via Tutor
On 08/09/17 08:35, George Fischhof wrote: > As this is a really frequent question, maybe it would be good to put a > short list (the answers cumulated no more than about 10 websites) into the > welcome message of the Tutor mailing list. The welcome message should be a very short (ideally one

Re: [Tutor] Fw: I want to display Integral symbols

2017-09-06 Thread Alan Gauld via Tutor
On 06/09/17 08:09, edmundo pierre via Tutor wrote: > So show us what you did. Its hard to figure out what's > gone wrong when we can't see your code:That is what I did: > from sympy import*from tkinter import*from sympy import init_printing > root = >

Re: [Tutor] Select a string

2017-09-06 Thread Alan Gauld via Tutor
On 06/09/17 06:34, Pat Martin wrote: > but my script returns 0. Since they want it to find 2 from the bobob in the > string using "bob in s" doesn't work (it only returns 1). Your code has bugs and Cameron has addressed those along with general advice on how to debug your code in future.

Re: [Tutor] Help With Python Tasks

2017-09-05 Thread Alan Gauld via Tutor
On 05/09/17 19:25, Ruth Hardy wrote: > I was wondering if you can help me please with these computer science tasks We can help, but we won;t do them for you. > First Task > > Write code do the following things involving strings. Wherever possible, > you should try to incorporate

Re: [Tutor] I want to display Integral symbols

2017-09-05 Thread Alan Gauld via Tutor
On 05/09/17 14:29, edmundo pierre via Tutor wrote: > I have been trying to display mathematics symbols on my Tkinter (using > Python) project, > but was not successful So show us what you did. Its hard to figure out what's gone wrong when we can't see your code. And that includes telling us

Re: [Tutor] Executing "if :" function on terminal

2017-09-05 Thread Alan Gauld via Tutor
On 05/09/17 08:56, Nathan Kckaiyer wrote: > i have just started learning python. I have repeatedly hit a road > block on my mac os terminal . Everytime i use the "if :" command i > get syntax errors. The problem is that you are somehow executing the Python interpreter prompt in the

Re: [Tutor] Python 3 for Beginners was: (Re: intro book for python)

2017-09-03 Thread Alan Gauld via Tutor
On 03/09/17 11:02, Leam Hall wrote: > Anyone that uses python on Linux has to use Python 2. Errr, nope. I use python 3 on Linux all the time. My last significant Python 2 program was about 4 years ago. It may be true that the distro maintainers are still using python 2 for historical reasons

Re: [Tutor] Problems Plotting in 3D

2017-08-31 Thread Alan Gauld via Tutor
On 31/08/17 07:18, Kendall Evans wrote: > I am calculating the youngs modulus for a crystal > Find S=inv(C) > Modulus = S(1,1)^-1 I assume you will be using SciPy for this? There are dedicated fora for SciPy stuff where you might find someone who has been down

Re: [Tutor] easygui

2017-08-27 Thread Alan Gauld via Tutor
On 27/08/17 03:07, George Sconyers via Tutor wrote: > Hello all. Need some help with easygui which my son is trying to run for a > book he is working in. I'm not sure what the current status of easygui is, I read somewhere that it had been discontinued. But if you are still finding a download

Re: [Tutor] How to use subprocess module to get current logged in user?

2017-08-26 Thread Alan Gauld via Tutor
> My objective: Determine who the currently logged in user is and > determine if that user is in my list of users that I have authorized > to use my programs. In addition to Steve and Mats answers: import os os.getlogin() #-> 'alan' os.getuid() #-> 1001 import pwd pwd.getpwuid(os.getuid())

Re: [Tutor] Does matplotlib.finance still work?

2017-08-25 Thread Alan Gauld via Tutor
On 25/08/17 15:19, C W wrote: > I did not mean to leave out the error message, it was very long. That just means it has a lot of information in it :-) > I think the package has been removed. I don;t think so based on the traceback... quotes = quotes_historical_yahoo_ochl('APX', start,

Re: [Tutor] Does matplotlib.finance still work?

2017-08-24 Thread Alan Gauld via Tutor
On 24/08/17 14:51, C W wrote: > I have the following code, I get an error at the first line. So don't make us guess. What is the error(full text please)? > from matplotlib.finance import quotes_historical_yahoo_ochl And what does a dir() show for matplotlib.finance? Are you sure the name is

Re: [Tutor] When to use classes

2017-08-22 Thread Alan Gauld via Tutor
On 20/08/17 02:08, Steven D'Aprano wrote: > Raymond Hettinger has a good video presentation about the use of classes > and inheritance for delegating work. (That is not to be confused with > delegation as an alternative to inheritance.) No, but I think it would have been useful if he had made

Re: [Tutor] When to use classes

2017-08-20 Thread Alan Gauld via Tutor
On 20/08/17 02:47, Steven D'Aprano wrote: > since then feels like going back to the Dark Ages. Having to care about > low-level details like creating buttons, installing callbacks and so > forth just feels wrong. To be fair most GUI frameworks come with a GUI builder that remove the manual

Re: [Tutor] help with subprocess module

2017-08-19 Thread Alan Gauld via Tutor
On 19/08/17 11:13, kay Cee wrote: > import subprocess > import time > import datetime > > class UpdateError(Exception): > pass In defining your own type of Exception you implicitly say that you will be raising it somewhere. But you never raise this exception in your code... > def update():

Re: [Tutor] When to use classes

2017-08-19 Thread Alan Gauld via Tutor
On 19/08/17 17:00, boB Stepp wrote: > I try to keep this in mind. Another thing I'm currently struggling > with is when to use inheritance vs. separate, independent classes. The golden rule is if the child is not a kind-of the parent then it should be delegation not inheritance. Never use

Re: [Tutor] When to use classes

2017-08-19 Thread Alan Gauld via Tutor
On 19/08/17 10:04, Peter Otten wrote: > nicer interface. Nobody would want to write > > a + b * c > > as > > add(a, mul(b, c)) Unless they program in Lisp perhaps :-) -- 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] When to use classes

2017-08-19 Thread Alan Gauld via Tutor
On 19/08/17 08:52, Alan Gauld via Tutor wrote: Following up my own post - a sure sign of failure to communicate :-( > On 19/08/17 05:26, boB Stepp wrote: > >> related methods needs to share the same values and a class would tidy >> this up nicely without the need for any

Re: [Tutor] When to use classes

2017-08-19 Thread Alan Gauld via Tutor
On 19/08/17 05:26, boB Stepp wrote: > related methods needs to share the same values and a class would tidy > this up nicely without the need for any globals or needless passing of > the exact same values around as parameters/arguments. Indeed, but its important to remember that class attributes

Re: [Tutor] Help....

2017-08-17 Thread Alan Gauld via Tutor
On 17/08/17 14:17, edmundo pierre via Tutor wrote: > I am trying to write a code to solve a system of equation at 2 variables. > I used Tkinter to do it. More significantly you used numpy to do it and that seems to be where the issues lie, not in Tkinter. Numpy is part of SciPy which has a

Re: [Tutor] Tutor Digest, Vol 162, Issue 42

2017-08-17 Thread Alan Gauld via Tutor
On 17/08/17 12:43, Howard Lawrence wrote: > On Aug 17, 2017 3:17 AM, wrote: ... > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Tutor digest..." Please follow the instructions. Change the subject line. And don't post the

Re: [Tutor] (no subject)

2017-08-16 Thread Alan Gauld via Tutor
On 16/08/17 23:36, Howard Lawrence wrote: > class Address: > def _init_(self,Hs,St,Town,Zip): > self.HsNunber=Hs > self.Street=St > self.Town=Town > self.Zip=Zip > Addr=Address (7, ' high st',

Re: [Tutor] Object takes no parameters

2017-08-16 Thread Alan Gauld via Tutor
On 17/08/17 01:08, Howard Lawrence wrote: > class Human: > def _init_(self, n, o) > self.name = n > self.occupation = o > > > tom = Human('tom cruise', 'actor') > > Traceback most recent call last > File "c:\users\shaun\python\python35\human_class.py"line 16 in module

Re: [Tutor] pygame not working

2017-08-16 Thread Alan Gauld via Tutor
On 16/08/17 17:33, Quantz Jeremy wrote: > I’m not sure if I should be asking here about this, Strictly speaking no, this list is for questions about Python and its standard library. So PyGame issues should really go to the PyGame support fora, and that's still the best place for detailed support.

Re: [Tutor] "Path tree"

2017-08-16 Thread Alan Gauld via Tutor
On 16/08/17 02:02, Cameron Simpson wrote: > Ok. So you have a graph like this: > 1 -- 2 -- 3 -- 4 >| > 7 -- 5 -- 6 -- 8 > > graph = { > 1: [2], > 2: [1, 3], 2: [1, 3, 5], > 3: [2, 4], > 4: [3], > 5: [7, 6], 5: [2, 6, 7], > 6: [5, 8], >

Re: [Tutor] Long post: Request comments on starting code and test code on chess rating project.

2017-08-16 Thread Alan Gauld via Tutor
On 16/08/17 04:06, boB Stepp wrote: >> I agree with Neil, this is exactly what SQL is good for and >> would make this part of the project much easier and would have >> the added benefit of introducing you to one of the trickiest, >> but most common, bits of OOP - object persistence... > > Would

Re: [Tutor] Long post: Request comments on starting code and test code on chess rating project.

2017-08-15 Thread Alan Gauld via Tutor
On 15/08/17 15:09, Neil Cerutti wrote: >> There are a variety of reports that I would like to be able to >> print to screen or paper. Things such as a "Top x List" of >> rated players, full rating list sorted from highest rating to >> lowest, rating lists for the current school year only or a >>

[Tutor] Fwd: Re: "Path tree"

2017-08-14 Thread Alan Gauld via Tutor
Forwarding to the list. Forwarded Message pic http://imgur.com/a/CwA2G On Mon, Aug 14, 2017 at 8:55 AM, Alan Gauld via Tutor <tutor@python.org <mailto:tutor@python.org>> wrote: On 13/08/17 21:07, Michael C wrote: > Please look at the p

Re: [Tutor] "Path tree"

2017-08-14 Thread Alan Gauld via Tutor
On 13/08/17 21:07, Michael C wrote: > Please look at the picture attached: This is a text mailing list, no binary attachments allowed. The server strips them off. You need to put it on a web site and provide a link. > consisting of (x,y). Now I am trying to make a function go through this >

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