On 04/04/17 00:37, D.V.N.Sarma డి.వి.ఎన్.శర్మ wrote:
> I will go for this modification of the original code.
> count = 0
> b= '3'+b[2:]
> n = len(b)
> for i in range(n-4):
> if b[i:i+4] == get_year:
> count += 1
While I think this works OK, I would probably suggest
that this is one
On 03/04/17 19:43, Ed Manning wrote:
> untrust_ip_address = raw_input('\nEnter the untrust IP ''"Example
> 172.20.2.3/28"'':')
> while not ipaddress.ip_network untrust_ip_address:
Doesn't that give a syntax error?
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
On 03/04/17 16:42, D.V.N.Sarma డి.వి.ఎన్.శర్మ wrote:
> Sorry. That was stupid of me. The loop does nothing.
Let me rewrite the code with some different variable names...
>>> with open(file_path) as a:
>>> b = a.read()
with open (file_path) as PI_text:
PI_as_a_long_string =
On 03/04/17 16:42, D.V.N.Sarma డి.వి.ఎన్.శర్మ wrote:
> Sorry. That was stupid of me. The loop does nothing.
>
On the contrary, the loop does an awful lot, just
not what the OP was expecting.
>>> with open(file_path) as a:
>>> b = a.read()
>>> for year in b:
>>> if get_year in b:
>>>
On 03/04/17 16:07, D.V.N.Sarma డి.వి.ఎన్.శర్మ wrote:
> Modifying the code as shown below may work.
I doubt it.
> with open(file_path) as a:
> b = a.read()
>
> get_year = input("What year were you born? ")
>
> count = 0
> for year in b:
Once more I ask, what does this loop do?
> if
On 03/04/17 13:22, Rafael Knuth wrote:
> with open (file_path) as a:
> b = a.read()
>
> get_year = input("What year were you born? ")
>
> for year in b:
Can you explain what you think this loop line is doing?
I'm pretty sure it's not doing what you expect.
> if get_year in b:
>
On 03/04/17 05:34, Quang nguyen wrote:
> I do not know how to run my python 3 script after my PI2 finished startup.
This might be a better question for a PI forum since it doesn't
seem to have anything directly to do with Python.
> the easy way to run at startup with escape plan?.
You will
On 02/04/17 18:41, Stephen P. Molnar wrote:
> I am trying to port a program that I wrote in FORTRAN twenty years ago
> into Python 3 and am having a hard time trying to calculate the
> Euclidean distance between each atom in the molecule and every other
> atom in the molecule.
Sounds highly
On 01/04/17 17:29, Alex Kleider wrote:
> Good point! I hadn't considered IPV6 and didn't know about the ipaddress
> module.
Me too, on both counts. Actually I should have known about
ipaddress because this question has come up before but
I'd forgotten... :-(
And as for forgetting IP6 - as an
On 01/04/17 00:35, Ed Manning wrote:
>
> What's the best way to validate a string contains a IP address
It depends on how thorough you want to be.
You can define a regex to check that its 4 groups of numbers
separated by periods.
Or you can split the string into fields and validate that
the
On 31/03/17 13:19, Stephen P. Molnar wrote:
> I have a block of data extracted from a quantum mechanical calculation:
How is this data stored? On paper? In a database? In XML? A CSV file?
Plain text? The answer to that will go a long way to pointing you in the
right direction for a solution.
>
On 31/03/17 12:23, Igor Alexandre wrote:
> I have a sitemap in XML and I want to use it to save as text the various pages
What about non-text pages such as images and media files?
> I'm looking for some code on the web where I can just type the xml address
> and wait for the crawler to do it's
On 30/03/17 21:35, Pooja Bhalode wrote:
> *However, when I execute it, and type something in one entrybox, it shows
> in all the entry boxes using multi-cursor option. *
I'm not sure whats going on and don;t habe tome to experiment but one
thing I noticed:
> average = [" ", " ", " "]
> lowest =
On 30/03/17 13:40, Alexandru Achim via Tutor wrote:
> Dear users,
> I had a problem regarding Threads in python and Gtk3.
This list is really for the core language and library, I suspect you
might get a better response by asking on the PyGTK forum where there are
more likely to be people who have
On 30/03/17 21:08, Alan Gauld via Tutor wrote:
> Of course, the __init__ methods are special in any way
Should have said *not special* in any way...
> But remember that not calling super potentially leaves
> some attributes of your superclass uninitialized. By not
> calling supe
On 30/03/17 12:39, Rafael Knuth wrote:
I am trying to wrap my head around the super constructor.
>
> Is it possible to embed a super constructor into an if / elif
> statement within the child class?
Of course, the __init__ methods are special in any way
the normal coding mechanisms all
On 29/03/17 15:33, Rafael Knuth wrote:
> I am trying to wrap my head around the super constructor.
This is one of these cases where it matters whether you
are using Python v2 or v3. Use of super in v3 is much
easier. It looks from your examples like you are using
v2 but it would be good to
On 28/03/17 15:56, Elo Okonkwo wrote:
> Can someone pls explain this Merge Sort Algorithm,
You can try reading this generic explanation.
It's not Python but the explanation seems fairly clear.
http://www.personal.kent.edu/~rmuhamma/Algorithms/MyAlgorithms/Sorting/mergeSort.htm
HTH
--
Alan G
On 28/03/17 17:45, Rafael Knuth wrote:
> Question: When should I use functions?
> When should I use classes?
Thee is no definitive answer but here are some
guidelines:
1) Many instances -> class
2) Many methods sharing the same data -> class
3) An algorithm that has no side effects -> a function
On 27/03/17 17:22, Pooja Bhalode wrote:
> The scrollbar goes not work in the window.
Define 'not work'?
You haven't connected it to anything and it doesn't
respond to any events so what kind of work did you
expect it to do? I assume it draws itself on screen
and the scroll buttons operate OK
On 25/03/17 04:29, Braxton Jackson wrote:
> Is there a simple command for retrieving the chosen value a user inputs
> from a dropdown list? I am new to Python and cant seem to find a good
> tutorials link on retreiving drop down values.
That all depends on which GUI toolkit you are using.
The
On 25/03/17 10:01, Peter O'Doherty wrote:
> def myFunc(num):
> for i in range(num):
> print(i)
>
> print(myFunc(4))
> 0
> 1
> 2
> 3
> None #why None here?
Because your function does not have an explicit return
value so Python returns its default value - None.
So the print() inside
On 24/03/17 21:42, boB Stepp wrote:
>> I noticed that you split your class into three methods:
Many real world classes have a lot more than 3 methods.
>> def __init__(self):
>> # initialize instances of class
>>
>> def make_shopping_list(self):
>> # input
>>
>> def display_shopping_list(self):
On 24/03/17 21:41, boB Stepp wrote:
>> I have a question: When creating an instance of GroceryListMaker, you are
>> using:
>>
>> if __name__ == "__main__":
>>
>> What is that specifically for?
Its a common trick in Python that enables a single file to
act as both a module and a program. When a
On 23/03/17 10:15, Richard Mcewan wrote:
> #loop to check guess and report
> while userGuess != computerGuess:
> if userGuess < computerGuess:
> print('Too low')
> userGuess = getUser()
> elif userGuess > computerGuess:
> print('Too high')
>
On 22/03/17 12:30, Rafael Knuth wrote:
> I wrote a function that does exactly what I want, and that is:
> Create a shopping list and then let the user decide which items (food)
> are supposed to be instantly consumed and which ones stored.
That's a good start, because it means you understand
On 22/03/17 21:17, Richard Mcewan wrote:
> I'm expecting two functions to be defined. Then called.
And thats what you've got. But...
> One returns a random number. The other user input (guessing the number).
And thats also what you've got but you don't do anything
with the returned value you
On 20/03/17 19:37, Edzard de Vries wrote:
> I have a CSV which I want to be able to read in Python.
Are you using the csv module?
Have you read the documentation for that?
It gives several examples.
If not already then use csv. If you are using it
and still have problems send the code and
On 20/03/17 22:09, ਪੰਜਾਬ ਪੰਜਾਬੀ wrote:
> Looking for recommendations on Python module to use to generate HTML
> pages/tables, other HTML content. Kindly help.
While thee are some modules that help with this most Python
programs I've seen just generate the HTML directly as strings.
There is no
On 19/03/17 12:17, Rafael Knuth wrote:
> LogActivities = []
> prompt = ("What have you done today? ")
> prompt += ("Enter 'quit' to exit. ")
I'm not sure why you put that on two lines but
thats just a nit pick...
> while True:
This will loop forever unless you explicitly break,
return or hit an
On 17/03/17 14:46, Aaliyah Ebrahim wrote:
> Hi, in my code below, why is it returning a value that is greater than 1200
> if my condition is that the value should be less than 1200?
Your condition is that it be less than 1200 when it enters the loop
body. That means it will *always* be 1200 or
On 16/03/17 05:11, Aaliyah Ebrahim wrote:
> def sum2(N):
>
> b = np.arange(1,N+1,1)
> mylist = [ ]
> for i in b:
> terms = 2*(1+3**(i-1))
> a = mylist.append[terms]
> return np.sum(mylist)
> terms = 2*(1+3**(i-1))> 9 mylist.append[terms] 10
>
On 14/03/17 14:29, Madhu Venkat wrote:
> try:
> Conn = cx_Oracle.connect (self.dsn)
> except cx_Oracle.DatabaseError as exception:
>
> dsn has all the required connection info.
>
> In this case, I believe I don't need TNSnames.ora file, please confirm.
I don't know
> I want libraries that contain algorithms to check for relationships
> within a dataset. For example, I want to parse through a SES dataset to
> see any possible connections between student achievement and
> socioeconomic standing, and correlate that to neighborhood wealth.
Ok, With that
message
From: Alan Gauld via Tutor <tutor@python.org>
Date: 3/10/17 8:13 PM (GMT-05:00)
To: tutor <tutor@python.org>
Subject: [Tutor] Fwd: Re: Sklearn
Forwarding to list...
Please use ReplyAll or ReplyList when responding to the tutor list.
--
> I woul
Forwarding to list...
Please use ReplyAll or ReplyList when responding to the tutor list.
--
> I would like to carry statistical analyses of populations .
> I've been that it's the best package for that sort of thing in Python,
> but I'm new to machine learning, so I'm not
On 10/03/17 23:12, Daniel Bosah wrote:
> Can someone explain sklearns to me?
Not me, I've never heard of it till now.
> I'm a novice at Python, and I would
> like to use machine learning in my coding.
Why?
What do you know about machine learning?
What other platforms support it?
> But aren't
On 10/03/17 12:38, leam hall wrote:
> As noted, the fix was to put the "import socket" above the class
> declaration. What confuses me is that in the calling program I'm importing
> the class:
>
> from mysocket import mysocket
>
> In mysocket.py the "import socket" is above the class
On 10/03/17 10:50, Eloka Chima via Tutor wrote:
Please post in plain text. Your email is unreadable...
And please don't reply to the digest, and if you must,
then at least delete the irrelevant bits. We've all
seen these messages already and some people pay
by the byte.
> Thank you so much.
On 09/03/17 18:42, Eloka Chima via Tutor wrote:
> Is my code okay.
>
> THERE IS AN ERROR/BUG IN YOUR CODE
> Results: Traceback (most recent call last): File "python/nose2/bin/nose2",
> line 8,
Evidently not.
But the error messages are unreadable, please send
in plain text.
--
Alan G
Author
On 09/03/17 13:28, Eloka Chima via Tutor wrote:
> My assignment below is ridden with bugs
So tell us what they are don;t make us guess and
don't expect us to run code which is by your
own admission faulty! If you get error messages
post them, in full.
If it runs but misbehaves tell us what
On 09/03/17 06:05, Sreekul Nair wrote:
> Running this simple program ends in following error -
> File "C:\Python27\lib\imaplib.py", line 520, in login
> raise self.error(dat[-1]) error: LOGIN failed.
First thing to test with errors like this is can
you login manually over telnet/ssh using the
On 09/03/17 06:06, Alex Kleider wrote:
> It seems you are simply kicking the can down the road rather than
> explaining how it it is that dot notation actually works.
The dot notation is just a method access. Dictionaries
are like any other object and have many methods.
> To access a
On 09/03/17 04:29, Alex Kleider wrote:
>> I'd probably opt for a dictionary:
>>
>> def f(lst):
>> res = {}
>> for item in lst:
>> res.setdefault(item,[]).append(item)
>> return list(res.values())
>>
> The above works BUT
> how
setdefault returns the current value for the key
On 08/03/17 19:56, Sri Kavi wrote:
> It’s about making a function that returns a list of lists, with each list
> being all of the elements that are the same as another element in the
> original list.
This is one of those problems where there is probably no
definitive "correct" answer just
On 06/03/17 19:03, Sri Kavi wrote:
> Wow, this works like a charm!
> def power(base, exponent):
> """ Returns base**exponent. """
> result = 1
> for _ in range(abs(exponent)):
> result *= base
> if exponent < 0:
> return 1 / result
> return result
And just to
On 06/03/17 17:35, leam hall wrote:
> What am I missing?
I'd start by moving the import out of the class to
its more normal position at the top of the file.
>
> class mysocket():
> import socket
> def __init__(self, sock=None);
> if sock is None:
> self.sock =
On 06/03/17 01:33, Rafael Skovron wrote:
> This project compares two text files with parcel numbers. I think I'm
> messing up the function call. I'm getting this error:
>
> Traceback (most recent call last):
> File "amador.py", line 48, in
> remaining_parcels(auctionlist,removedlist)
>
On 06/03/17 03:07, ramakrishna reddy wrote:
> Can you please explain the functionality of collections.Callable ? If
> possible with a code snippet.
First of all, do you understand the concept of callable in Python?
Any object that can be used like a function is callable.
You might have a mixed
On 04/03/17 01:47, Alan Gauld via Tutor wrote:
>> Can you please guide me to an example related to this problem?
I had a play and here is a simple DisplayTable widget.
Its still not a scrollable frame (although i might get round
to that later...) But it takes a list of headings and a 2
On 04/03/17 01:37, Tasha Burman wrote:
> I am having difficulty with a power function;
> what is another way I can do 4**9 without using **?
You can use the pow() function.
answer = pow(4,9)
However, I'm not sure that really answers your question?
Do you mean that you want to write your own
On 03/03/17 22:59, Jason Snyder wrote:
> I installed the python module matplotlib on a computer and when I try to
> run a program with the commands:
>
> import matplotlib.pyplot as plt I get the following errors:
It could be an installation issue, but really this list
is for the core language
On 03/03/17 21:15, Pooja Bhalode wrote:
> Hi Alan,
>
> Can you please guide me to an example related to this problem? I do not
> know how to use the scrollable frame, set backgrounds etc.
> Sorry, I am new to tables in Tkinter. I could not find any examples as well
WE are all new to tables in
On 04/03/17 00:28, Jason Snyder wrote:
> I have the following program where I am trying to generate a pdf:
> 6 from matplotlib.backends.backend_pdf import PdfPages
> 7 import numpy as np
> 13 with PdfPages('wx_plot.pdf') as pdf:
> When I run it I get the following error:
>
>
On 03/03/17 20:59, Pooja Bhalode wrote:
> I tried putting in the event handlers for the checkbuttons as shown below.
>
> num = 0
> def selfcheck(event):
> print "Self Check"
> num = num + 1
> if num == 2:
You need num to be inside the function since it needs
to be reset to zero
On 03/03/17 16:43, Pooja Bhalode wrote:
> I am trying to create a GUI with four options out of which the user is
> supposed to select two. But once the user selected two out of those four
> options, the others need to get greyed out at that instant.
>
> I tried the following thing:
>
>
On 03/03/17 16:07, Pooja Bhalode wrote:
> The table that I am trying to get is a table with scrollable rows. I just
> want to display the data in the table in the Tkinter window. I do not wish
> to make it interactive, since just want to display the data.
In that case you could just use a
On 03/03/17 18:52, Peter Otten wrote:
> Antonio Zagheni via Tutor wrote:
>
>> suitcase = ["book, ", "towel, ", "shirt, ", "pants"]
>
> Hm, looks like you opened Rafael's suitcase while he wasn't looking, and
> sneaked in some commas and spaces ;)
>
> That's cheating...
Its also very
On 02/03/17 22:20, Quang nguyen wrote:
> Right now, I need to use pi_switch in order to send data through RF system
> by Pi2. Until now, I installed everything it need from an article on the
> internet. Those things are python-dev, libboost-python-dev, python-pip, and
> I used pip to install
On 02/03/17 14:25, Pooja Bhalode wrote:
> when I tried to install tkintertable using pip: i got the following errors:
>
> OSError: [Errno 13] Permission denied:
> '/Library/Python/2.7/site-packages/Pmw'
Based on this I'm guessing you need to run pip with sudo?
--
Alan G
Author of the Learn
On 02/03/17 13:42, Rafael Knuth wrote:
> bar = ["beer", "coke", "wine"]
>
> customer_order = input("What would you like to drink, dear guest? ")
>
> for drink in bar:
> if customer_order != drink:
> print ("Sorry, we don't serve %s." % customer_order)
> else:
> print
On 01/03/17 18:23, Jason Snyder wrote:
> I have a grib2 file with wind data at multiple taus as shown below:
This list is for the core Python language and standard library.
For anything outside that you are more likely to get answers
on the specific library support forum or community.
If that
On 01/03/17 20:20, Stephen P. Molnar wrote:
> I have written a Python3 program to plot and save UV/VIS spectra from
> the results of an Orca quantum mechanical calculation.
Caveat: This forum is for help on the core Python language
and its standard library. Asking about anything beyond that
may
On 01/03/17 23:40, Pooja Bhalode wrote:
> I am trying to create normal tables in Tkinter.
First you need to define what a "normal table" is.
There is no such thing in standard Tkinter, so any
kind of table is not normal.
Do you want a simple grid of values?
Do you want a spreadsheet type grid
On 01/03/17 10:09, Leam Hall wrote:
> I see computer science as a science that calls upon our creative nature
> to produce excellence. Adding constraints like secure coding and TDD
> push us to even greater artistic expression. Lack of constraints gives
> us the current standard of
On 01/03/17 10:50, Peter Otten wrote:
>> sees your call as something like:
>>
>> total(name = "John", 1, 2, 10 )
>
> I think total(name="John", *(1, 2, 3))
>
> is rather resolved as
>
> total(1, 2, 3, name="John")
>
Ah, yes that makes sense. Thanks for the
clarification Peter (and Steven).
On 01/03/17 08:18, Pabitra Pati wrote:
> def total(name, *args):
> if args:
> print("%s has total money of Rs %d/- " %(name, sum(args)))
> else:
> print("%s's piggy bank has no money" %name)
>
> I can call this method passing the extra arguments
On 01/03/17 01:29, Quang nguyen wrote:
> send the signal to RF receiver through pins in Pi2. I need to send the
> signal from clicking a button in UI.
>
> Can anyone give me some hints?
What bit do you need help on?
Is it building a UI?
Is it clicking a button?
Is it sending the signal?
For
On 01/03/17 06:21, darrickbled...@gmail.com wrote:
> wage = eval(input("Enter in the employees hourly wage: ")) #get wage
> hours_worked = eval(input("Enter in the number of hours worked: "))
Don't use eval() like this it is a security risk
and is a very bad habit to get into. Instead use
an
On 27/02/17 22:00, Johnny Hh wrote:
> write a python function called find_most_freq() that returns the element of
> a given list that occurs the most frequently. If there are ties, take the
> number found first.
OK, You've shown us the exercise, now show us your attempt at a solution.
Here is a
On 27/02/17 14:57, leam hall wrote:
>> I'm not aware of such a list, and I'm not sure it's of much value.
>> Better to just learn what you need and use it. ...
> When I was coming up as a Linux guy I took the old SAGE guidelines and
> studied each "level" in turn. It was useful for making me a
On 27/02/17 20:52, Stephen P. Molnar wrote:
> To the best of my knowledge I am not running any anti-virus software.
> This has always been a Linux computer and there has been no need.
There are threats to Linux just fewer of them, plus you could
be used as a host to pass on damaged files so you
On 27/02/17 10:44, Leam Hall wrote:
> Is there a list of Python skill progression, like "Intermediates should
> know and Advanced should know ?" Trying to map out
> a well rounded study list.
I'm not aware of such a list, and I'm not sure it's of much value.
Better to just learn what you need
On 27/02/17 11:22, Allan Tanaka wrote:
> - And did you see chart.html in that listing?
> Yes it's there
>
> - How did you "proceed"?
> Did you click the link in the directorty listing
> or did you type it in by hand?
> I click the link in directory listing
OK, It looks like the server side is
On 27/02/17 10:40, Allan Tanaka via Tutor wrote:
> After typing python -m SimpleHTTPServer 8000 in CMD
> then i proceed to my google chrome and type http://allan-pc:8000/
OK, But to be safe I'd probably stick to 0.0.0.0 rather than your PC
name - it eliminates routing errors from the equation.
On 27/02/17 10:24, Alan Gauld via Tutor wrote:
> On 27/02/17 10:13, Allan Tanaka via Tutor wrote:
>> I have changed the syntax to be python -m SimpleHTTPServer 8000
>> to match my ml python script. Still it doesn't work?
A couple of other things to check:
1) does check.html
On 27/02/17 03:06, Pooja Bhalode wrote:
> for i in range(len(checkboxVars)):
> if checkboxVars[i].get() == 1:
>print checkboxVars[i]
>selectedparam.append(checkboxVars[i])
As a point of Pythonic style this would be better
written (and easier to read) as
for var in
On 27/02/17 10:13, Allan Tanaka via Tutor wrote:
> I have changed the syntax to be python -m SimpleHTTPServer 8000
> to match my ml python script. Still it doesn't work?
Define "doesn't work"?
What happens? Do you see an error message - if so which one?
What happens if you use the base url?
On 27/02/17 03:06, Pooja Bhalode wrote:
> The following code creates a list of checkboxes
It would really help uif you posted in plain text.
The HTML/RTF is getting very hard to read with
no indentation.
> ones that user wants, I am trying to add the selected variables to another
> list so that
On 27/02/17 02:44, Allan Tanaka via Tutor wrote:
> I try to access it with http://0.0.0.0:8000/chart.html via Google Chrome,
> On 18/02/17 04:46, Allan Tanaka via Tutor wrote:
>> Not completely sure why it doesn't open the chart on the web browser
>> when i type this in the windows command
On 26/02/17 06:44, Phil wrote:
> s.connect((host, 1210))
> data = "GET_LIST"
This is a string, you need to use bytes.
data = bytes("GET_LIST",'utf8')
> s.sendall(data)
> #s.sendto(data, (host, 1210))
> s.shutdown(1)
> Traceback (most recent call last):
>File
On 25/02/17 17:24, Alan Gauld via Tutor wrote:
>> If you don't know that you need to optimize then your
>> time is usually better spent elsewhere. Dictionaries
>> are pretty fast in Python and I'd suggest you try
>> that first before shaving milliseconds in places
>
On 25/02/17 10:35, ehsan faraz wrote:
> ... where “tip” is an invalid syntax.
You need to assign a value to tip before trying
to read it, otherwise tip is undefined.
Similarly you should define price before trying
to use it.
But those would give you a NameError not a
syntax error... Can you
On 25/02/17 17:12, Rafael Knuth wrote:
> I want to compare two strings and count the number of identical letters:
>
> stringB = "ABCD"
> stringA = "AABBCCDDEE"
> for b in stringB:
> if b in stringA:
> r = 0
> r += 1
> print (r)
>
> How do I count the output (r)
Forwarding to list.
Please always use reply-All or Reply-list when responding to the list.
On Feb 18, 2017, at 6:21 PM, Alan Gauld via Tutor <tutor@python.org
<mailto:tutor@python.org>> wrote:
>
> On 18/02/17 21:52, Joseph Slater wrote:
>> I'm trying to use the scipy.o
On 24/02/17 14:39, Pooja Bhalode wrote:
> list, and then move to the next list, I loose the selections made on the
> screen in the first list. I can however print it out and store it in the
> code, but I would like to show it on the screen as well
Peter has given you the answer: you need to
On 24/02/17 02:04, Quang nguyen wrote:
> Right now, I have school project for sending signal from Pi2 to
> mutilple devices. And I am using 433Utils library for sending
> and receiving signal. They provided file for do that but it only
> execute on terminal, and i also have an UI.
>
> So I have an
On 23/02/17 22:25, Pooja Bhalode wrote:
> I am working on GUI where I have two dropdown menus in a Toplevel of the
> main root.
That's not what your code shows. It shows scrolling listboxes, not
menus. But it seems like a Frame with a set of checkboxes would be
closer to what you actually want?
On 23/02/17 22:16, Quang nguyen wrote:
> Hi everyone,
> I need to open a terminal on Raspberry Pi 2 in order to execute codesend of
> 433Utils to send a signal to RF Receiver. Anyone know how to open a
> terminal?
Do you really need a terminal? Or do you only need to execute some commands?
In
On 23/02/17 04:25, boB Stepp wrote:
> I am trying to wrap my head around the mechanics of inheritance in
> Python 3. I thought that all attributes of a superclass were
> accessible to an instance of a subclass.
For class attributes that happens automatically.
>>> class A:
a = 'A'
On 22/02/17 02:55, Francis Pino wrote:
> I need to recode my hotel ratings as 1-3 = Negative and 4-5 Positive. Can
> you help point me in the direction to do this? I know I need to make a loop
> using for and in and may statement like for rating in review if review >= 3
> print ('Negative')
On 21/02/17 09:49, Rafael Knuth wrote:
> class DiscountCustomer(FullPriceCustomer):
> discount = 0.7
> def calculate_discount(self, rate, hours):
> print ("Your customer %s made you %s USD at a 30% discount
> rate this year." % (self.customer, self.rate * rate * discount))
I
On 21/02/17 09:49, Rafael Knuth wrote:
> class FullPriceCustomer(object):
> def __init__(self, customer, rate, hours):
>
>
> class DiscountCustomer(FullPriceCustomer):
> discount = 0.7
> def calculate_discount(self, rate, hours):
>
> customer_one = DiscountCustomer("Customer A",
Please post in plain text. Formatting is very important in
Python and RTF or HTML tend to get scrambled in transit
making your code and error hard to read.
Thanks
Alan G.
On 20/02/17 14:32, Joe via Tutor wrote:
> Hi,
> I keep getting the following error as I am new to programming and I am
>
On 20/02/17 14:54, Pooja Bhalode wrote:
> Another issue, in this that is happening which is far more important from
> the perspective that I am looking at, is that when I click the button
> twice, two graphs get created one below the other.
>
> I tried adding a delete("all") statement as shown
On 19/02/17 16:34, Marie Shaw via Tutor wrote:
> I am a teacher of 16-18 year olds.
> I now need to teach them OOP using Python,
> and GUI programming using Python.
Those are two different topics, although most GUIs
are easier if used with OOP.
However, most tutorials (including mine) teach
On 19/02/17 16:18, Pooja Bhalode wrote:
> Hi,
>
> I am trying to create a simple table. But I was wondering how do I get the
> title of the table to span over multiple columns in the first row.
> Code:
>
> from Tkinter import *
>
> root = Tk()
> root.geometry("700x500")
> Label(root, text =
On 20/02/17 09:36, Steven D'Aprano wrote:
> Comma after "button" is not needed.
>
> cmds.button(label ="button" + srt(i+1))
>
> may be better.
and
cmds.button(label ="button" + str(i+1))
better still :-)
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
On 18/02/17 21:52, Joseph Slater wrote:
> I'm trying to use the scipy.optimize code ...
> I've seen this done with dictionaries on some pages,
> but it seems that this is intended to be faster
There is a saying in programming that premature
optimization is the root of all evil.
If you don't
Please don't repeat post. We saw it the first time.
Please do post again with the extra information requested.
On 18/02/17 04:46, Allan Tanaka via Tutor wrote:
> Not completely sure why it doesn't open the chart on the web browser when i
> type this in the windows command prompt (cmd) python -m
901 - 1000 of 9336 matches
Mail list logo