Re: [Tutor] (no subject)

2019-03-26 Thread Matthew Herzog
elif fileDate = datetime.strptime(name[0:8], DATEFMT).date(): ^ SyntaxError: invalid syntax On Sat, Mar 23, 2019 at 6:43 PM Mats Wichmann wrote: > On 3/23/19 3:16 AM, Peter Otten wrote: > > > Personally I would use a try...except clause because with that you can > > handle

Re: [Tutor] (no subject)

2019-03-26 Thread Mats Wichmann
On 3/26/19 12:26 PM, Matthew Herzog wrote: > elif fileDate = datetime.strptime(name[0:8], DATEFMT).date(): >                    ^ > SyntaxError: invalid syntax are you assigning (=) or comparing (==)? you can't do both in one statement because of the side effect implications. [except that

Re: [Tutor] (no subject)

2019-03-23 Thread Mats Wichmann
On 3/23/19 3:16 AM, Peter Otten wrote: > Personally I would use a try...except clause because with that you can > handle invalid dates like _etc.xls gracefully. So > > ERASED = "erased_" > > > def strip_prefix(name): > if name.startswith(ERASED): > name =

Re: [Tutor] (no subject)

2019-03-23 Thread Peter Otten
Matthew Herzog wrote: > I have a Python3 script that reads the first eight characters of every > filename in a directory in order to determine whether the file was created > before or after 180 days ago based on each file's name. The file names all > begin with MMDD or

Re: [Tutor] (no subject)

2019-03-22 Thread Cameron Simpson
On 22Mar2019 17:45, Matthew Herzog wrote: I have a Python3 script that reads the first eight characters of every filename in a directory in order to determine whether the file was created before or after 180 days ago based on each file's name. The file names all begin with MMDD or

Re: [Tutor] (no subject)

2019-03-22 Thread Alan Gauld via Tutor
On 22/03/19 21:45, Matthew Herzog wrote: I need to tell my script to ignore any filename that does not conform to the standard eight leading numerical characters, example: 20180922 or erased_20171207_1oIkZf.so. Normally we try to dissuade people from using regex when string methods will do

Re: [Tutor] (no subject)

2019-03-18 Thread Tobiah
You need a space between 'def' and '__init__'. Then you must remove the import statement. The class is already defined in your scope and there is no module called 'Student'. Tobiah On 3/15/19 6:54 PM, Glenn Dickerson wrote: class Student(): def__init__(self, name, major, gpa,

Re: [Tutor] (no subject)

2019-03-16 Thread Peter Otten
Glenn Dickerson wrote: > class Student(): > > def__init__(self, name, major, gpa, is_on_probation): > self.name = name > self.major = major > self.gpa = gpa > self.is_on_probation = is_on_probation > > > import Student > student1 = Student('Jim', 'Business',

Re: [Tutor] (no subject)

2019-03-16 Thread Alan Gauld via Tutor
On 16/03/2019 01:54, Glenn Dickerson wrote: > class Student(): > > def__init__(self, name, major, gpa, is_on_probation): > self.name = name > self.major = major > self.gpa = gpa > self.is_on_probation = is_on_probation > > > import Student > student1 =

Re: [Tutor] (no subject)

2019-03-16 Thread Steven D'Aprano
Hi Glenn, and welcome. On Fri, Mar 15, 2019 at 09:54:41PM -0400, Glenn Dickerson wrote: > class Student(): > def__init__(self, name, major, gpa, is_on_probation): > self.name = name > self.major = major > self.gpa = gpa > self.is_on_probation = is_on_probation

Re: [Tutor] (no subject)

2018-11-12 Thread Avi Gross
In replying to what "Stealth Fleet" asked, I have too many comments, starting with a suggestion to put a SUBECT on the Subject: line. Your first error was not converting the text input to an integer or floating point number. tokenAmount = input( "How many tokens would you like to buy or

Re: [Tutor] (no subject)

2018-11-11 Thread Steven D'Aprano
On Sun, Nov 11, 2018 at 03:00:00PM -0800, Stealth Fleet wrote: [...] > tokenAmount works but the buy and cashIn are not being ran why? You define the function, but never call it. Functions aren't called automatically. py> def example(): ... print("calling example") ... py> py> # nothing is

Re: [Tutor] (no subject)

2018-10-27 Thread Bob Gailer
On Oct 27, 2018 7:48 AM, "Jesse Stockman" wrote: > > Hi there > > I need to draw a patten with turtle in python 3.7 but I cant get it to work here are the specs of the pattern and my code so far can you please help Thank you for asking for help. It would help us if you were more specific. "Can't

Re: [Tutor] (no subject)

2018-10-27 Thread boB Stepp
Greetings! On Sat, Oct 27, 2018 at 6:48 AM Jesse Stockman wrote: > > Hi there > > I need to draw a patten with turtle in python 3.7 but I cant get it to work > ... What is the problem? Describe what you expected to happen, what did happen, and *copy and paste* the Traceback that Python

Re: [Tutor] (no subject)

2018-10-19 Thread Albert-Jan Roskam
On 19 Oct 2018 18:09, Pat Martin wrote: TLDR; How do you figure out if code is inefficient (if it isn't necessarily obvious) and how do you find a more efficient - Hi, check this: https://docs.python.org/3/library/profile.html. Also, the timeit module is handy for smaller snippets.

Re: [Tutor] (no subject)

2018-06-01 Thread Alan Gauld via Tutor
On 31/05/18 07:06, erich callahana wrote: > I’m not sure how to access this window > Unfortunately this is a text mailing list and the server strips binary attachments for security reasons. Either send us a link to a web page or describe what it is you are trying to do. Include the program

Re: [Tutor] (no subject)

2018-04-25 Thread Kai Bojens
On 25/04/2018 –– 12:19:28PM -0600, Mats Wichmann wrote: > I presume that's pseudo-code, since it's missing punctuation (commas > between elements) and the country codes are not quoted Yes, that was just a short pseudo code example of what I wanted to achieve. > you don't actually need to

Re: [Tutor] (no subject)

2018-04-25 Thread Mats Wichmann
On 12/31/1969 05:00 PM, wrote: > Hello everybody, > I'm coming from a Perl background and try to parse some Exim Logfiles into a > data structure of dictionaries. The regex and geoip part works fine and I'd > like to save the email adress, the countries (from logins) and the count of > logins. >

Re: [Tutor] (no subject)

2018-03-28 Thread Mats Wichmann
On 03/28/2018 04:32 AM, Steven D'Aprano wrote: > On Wed, Mar 28, 2018 at 03:08:00PM +0900, naoki_morih...@softbank.ne.jp wrote: >> I want to install 3rd party module, ex openpyxl. >> And I executed the following command in windows command prompt as follows: >> pip install openpyxl >> But pip is

Re: [Tutor] (no subject)

2018-03-28 Thread shubham goyal
Use this link to install python package and make sure to add the path in environment variables (just click the option it asks when you run the setup, Add Python to path or something). Recent python packages include pip also so you will get your problem solved.

Re: [Tutor] (no subject)

2018-03-28 Thread Steven D'Aprano
On Wed, Mar 28, 2018 at 03:08:00PM +0900, naoki_morih...@softbank.ne.jp wrote: > I want to install 3rd party module, ex openpyxl. > And I executed the following command in windows command prompt as follows: > pip install openpyxl > But pip is not recognized as executable command at windows. What

Re: [Tutor] (no subject)

2018-02-14 Thread Mats Wichmann
On 02/14/2018 05:42 PM, Alan Gauld via Tutor wrote: > On 14/02/18 19:18, Nathantheweird1 wrote: >> I'm having a problem with my code on an interactive story. All the choices >> work until the end. When the code reaches the end, it will print different >> functions that aren't even set to be called

Re: [Tutor] (no subject)

2018-02-14 Thread Alan Gauld via Tutor
On 14/02/18 19:18, Nathantheweird1 wrote: > I'm having a problem with my code on an interactive story. All the choices > work until the end. When the code reaches the end, it will print different > functions that aren't even set to be called in the code. I'm not sure what > I've done wrong and

Re: [Tutor] (no subject)

2017-11-12 Thread Steven D'Aprano
Sorry 劉權陞 <01patrick...@gmail.com>, but this is an English-language mailing list. I do not understand what question you are asking. On Sun, Nov 12, 2017 at 11:54:52PM +0800, 劉權陞 wrote: > 我在使用closure 時,遇到了一些問題。 > 例如一個簡單的例子, > > def f1(a): > def f2(b): > return a+b > return f2 >

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] (no subject)

2017-10-05 Thread Mats Wichmann
On 10/03/2017 06:29 PM, Alan Gauld via Tutor wrote: > 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.

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] (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] (no subject)

2017-08-17 Thread Mats Wichmann
On 08/17/2017 05:45 AM, Howard Lawrence wrote: > Yes, it does. > > On Aug 16, 2017 8:02 PM, "Zachary Ware" > wrote: > > Hi Howard, > > On Wed, Aug 16, 2017 at 5:36 PM, Howard Lawrence <1019sh...@gmail.com> > wrote: >> class Address: >> def

Re: [Tutor] (no subject)

2017-08-17 Thread Howard Lawrence
Yes, it does. On Aug 16, 2017 8:02 PM, "Zachary Ware" wrote: Hi Howard, On Wed, Aug 16, 2017 at 5:36 PM, Howard Lawrence <1019sh...@gmail.com> wrote: > class Address: > def _init_(self,Hs,St,Town,Zip): Your issue is in this line, it should be `__init__`

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] (no subject)

2017-08-16 Thread Zachary Ware
Hi Howard, On Wed, Aug 16, 2017 at 5:36 PM, Howard Lawrence <1019sh...@gmail.com> wrote: > class Address: > def _init_(self,Hs,St,Town,Zip): Your issue is in this line, it should be `__init__` rather than `_init_` (that is, two underscores before and after "init"). Hope this helps, --

Re: [Tutor] (no subject)

2017-08-03 Thread Cameron Simpson
Hi, and welcome to the tutor list. Please try to provide a useful subject line in future posts (not "help", perhaps something like "I don't understand this TypeError message"). Anyway, to your question: On 03Aug2017 13:27, Howard Lawrence <1019sh...@gmail.com> wrote: hi ! i am newbie to

Re: [Tutor] (no subject)

2017-08-03 Thread boB Stepp
Greetings Howard! On Thu, Aug 3, 2017 at 3:27 PM, Howard Lawrence <1019sh...@gmail.com> wrote: > hi ! i am newbie to coding love it but need help with problems which i > searched but poor results this is the error: typeError unorderable types: > int() the code in short,

Re: [Tutor] (no subject)

2017-05-10 Thread leam hall
Oh...Spam with Curry! On Wed, May 10, 2017 at 8:18 PM, Alan Gauld via Tutor wrote: > On 11/05/17 01:02, Steven D'Aprano wrote: >> Looks like spam to me. A link to a mystery URL with no context, by >> somebody signing their email with a radically different name from the >> email

Re: [Tutor] (no subject)

2017-05-10 Thread Alan Gauld via Tutor
On 11/05/17 01:02, Steven D'Aprano wrote: > Looks like spam to me. A link to a mystery URL with no context, by > somebody signing their email with a radically different name from the > email address used, And the address is not subscribed to the list so the message should have gone to

Re: [Tutor] (no subject)

2017-05-10 Thread Steven D'Aprano
Looks like spam to me. A link to a mystery URL with no context, by somebody signing their email with a radically different name from the email address used, sending to ten different addresses, one of which is the sender. I'm not sure that we care about a URL for some curry house in Carlton,

Re: [Tutor] (no subject)

2017-04-09 Thread Alan Gauld via Tutor
On 09/04/17 11:42, shubham goyal wrote: > Hello, I am a c++ programmer and wants to learn python for internship > purposes. How can i learn the advanced python fast mostly data science > packages, I know basic python. There are tutorials on most things. But it depends on what you mean by advanced

Re: [Tutor] (no subject)

2017-04-09 Thread Mats Wichmann
On 04/09/2017 04:42 AM, shubham goyal wrote: > Hello, I am a c++ programmer and wants to learn python for internship > purposes. How can i learn the advanced python fast mostly data science > packages, I know basic python. Try an internet search? Don't mean to be snide, but there are lots of

Re: [Tutor] (no subject)

2017-04-02 Thread Peter Otten
Белякова Анастасия wrote: > Hi there! How are you? > I need an advise. > > I need to get values from html form, but form.getvalues['query'] returns > None. I took a quick look into the cgi module, and FieldStorage class doesn't seem to have a getvalues attribute. You should get an exception

Re: [Tutor] (no subject)

2017-02-08 Thread Alan Gauld via Tutor
On 07/02/17 21:09, တာန္ခတ္သန္ wrote: > RockPaperScissors game using dictionary. I have written my code and it > doesn't work at all. So what does it do? Crash your PC? Give an error? Run silently and stop? You need to be precise when telling us these things. If you get an error message send us

Re: [Tutor] (no subject)

2017-02-07 Thread David Rock
> On Feb 7, 2017, at 15:09, တာန္ခတ္သန္ wrote: > > > # RockPaperScissors > > import random > print ("Hello.. Welcome from Rock, Paper, Scissors Game!!\n" > +"Game instruction:\n" > +"You will be playing with the computer.\n" > +"You need to choose one of

Re: [Tutor] (no subject)

2016-12-14 Thread Juan C.
On Dec 10, 2016 12:15 PM, "Tetteh, Isaac - SDSU Student" > isaac.tet...@jacks.sdstate.edu> wrote: > > > > Hello, > > > > I am trying to find the number of times a word occurs on a webpage so I > used bs4 code below > > > > Let assume html contains the "html code" > > soup = BeautifulSoup(html,

Re: [Tutor] (no subject)

2016-12-10 Thread Bob Gailer
On Dec 10, 2016 12:15 PM, "Tetteh, Isaac - SDSU Student" < isaac.tet...@jacks.sdstate.edu> wrote: > > Hello, > > I am trying to find the number of times a word occurs on a webpage so I used bs4 code below > > Let assume html contains the "html code" > soup = BeautifulSoup(html,

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

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

Re: [Tutor] (no subject)

2016-07-26 Thread DiliupG
Thank you for the responses. Some filenames I use are in Unicode in this script and there is no display or typing problem in Windows (Vista, 7 and 10). Filenames and text in word processing and text files are ALL displayed properly WITHOUT any errors by the Windows system. When I use a standard

Re: [Tutor] (no subject)

2016-07-25 Thread eryk sun
On Tue, Jul 26, 2016 at 4:39 AM, DiliupG wrote: > I am reading in a list of file names with the following code. > > def get_filelist(self): > "" > app = QtGui.QApplication(sys.argv) > a = QtGui.QFileDialog.getOpenFileNames() > > filelist

Re: [Tutor] (no subject)

2016-07-25 Thread eryk sun
On Mon, Jul 25, 2016 at 10:28 AM, Steven D'Aprano wrote: > I know that Linux and Mac OS X both use UTF-8 for filenames, and so support > all > of Unicode. But Windows, I'm not sure. It might be localised to only use > Latin-1 > (Western European) or similar. Windows

Re: [Tutor] (no subject)

2016-07-25 Thread eryk sun
On Fri, Jul 22, 2016 at 7:38 AM, DiliupG wrote: > I am using Python 2.7.12 on Windows 10 > > filename = u"මේක තියෙන්නේ සිංහලෙන්.txt" > Unsupported characters in input That error message is from IDLE. I'm not an expert with IDLE, so I don't know what the following hack

Re: [Tutor] (no subject)

2016-07-25 Thread Steven D'Aprano
On Fri, Jul 22, 2016 at 01:08:02PM +0530, DiliupG wrote: > I am using Python 2.7.12 on Windows 10 Two errors: - first error is that Unicode strings in Python 2 need to be written as unicode objects, with a "u" prefix in the delimiter: # ASCII byte string: "Hello World" # Unicode string:

Re: [Tutor] (no subject)

2016-07-25 Thread Ramanathan Muthaiah
Hi Dilip, This error has nothing to do with Python or it's versions. OS does not have the support for these unicode characters. You need to fix that. > filename = "මේක තියෙන්නේ සිංහලෙන්.txt" > Why can't I get Python to print the name out? > > filename = "මේක තියෙන්නේ සිංහලෙන්.txt" >

Re: [Tutor] (no subject)

2016-07-08 Thread Sylvia DeAguiar
http://point.gendelmangroup.com/Sylvia_DeAguiar Sylvia Deaguiar Sent from my iPhone ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] (no subject)

2016-04-29 Thread Alan Gauld via Tutor
On 29/04/16 14:10, Павел Лопатин wrote: > Hello, > I downloaded Python 3.4.3 from python.org, installed it, > but when I tried to run it on my notebook a message appeared The error is about IDLE rather than about Python so its probably worth checking whether python itself runs first. Open a CMD

Re: [Tutor] (no subject)

2016-04-18 Thread Danny Yoo
On Mon, Apr 18, 2016 at 9:52 AM, Halema wrote: > Hello, > I have a project and need someone to help below you will see details about it > , please if you able to help email me as soon as possible and how much will > cost ! You might not realize this, but what

Re: [Tutor] (no subject)

2016-04-18 Thread Alan Gauld
On 18/04/16 17:52, Halema wrote: > Hello, > I have a project and need someone to help below you will see details about it > , > please if you able to help email me as soon as possible > and how much will cost ! The good news is it doesn't cost anything but time. The bad news is that we won;t do

Re: [Tutor] (no subject)

2016-04-16 Thread Danny Yoo
On Wed, Apr 13, 2016 at 12:15 PM, Eben Stockman wrote: > could you please help because it is really important as it counts towards my > Gcse Just to add: please try to avoid saying this detail in the future. It's much more helpful to talk about what you've tried, what

Re: [Tutor] (no subject)

2016-04-16 Thread Alan Gauld
On 13/04/16 20:15, Eben Stockman wrote: > Hi this is the code I have so far for the task Hi Eben. The code has disappeared, probably because you sent it as an attachment. This list is plain text and attachments often get stripped as potential security risks etc. Please repost with the code in

Re: [Tutor] (no subject)

2016-03-30 Thread Alan Gauld
On 30/03/16 13:18, Jay Li wrote: > > http://idealwm.com/miles.php > > Best regards, > Jay Li Apologies, a couple of these messages have snuck through this week. It's been entirely my fault, I've hit the approve button when I meant to hit reject. The server is

Re: [Tutor] (no subject)

2016-02-17 Thread Alan Gauld
On 16/02/16 22:32, taylor hansen wrote: > I have to type from myro import* and whenever I do that, > it says that there is no module named myro. myro is not a standard module so you need to install it from somewhere. Presumably your school can give you directions on that? For future reference

Re: [Tutor] (no subject)

2016-01-10 Thread Peter Otten
Lawrence Lorenzo wrote: > import randomimport timeimport math > #the player and NPC class.class char(object): #character attributesdef > #__init__(self, name, health, attack, rng, magic, speed):self.name > #= nameself.health = healthself.attack = attack >

Re: [Tutor] (no subject)

2016-01-10 Thread Alan Gauld
On 10/01/16 15:21, Lawrence Lorenzo wrote: Please use plain text to send mail. Your formatting makes the code unreadable. Thankfully the error does all the work for us... > import randomimport timeimport math > #the player and NPC class.class char(object): #character attributesdef >

Re: [Tutor] (no subject)

2015-07-25 Thread Alan Gauld
On 25/07/15 02:49, Job Hernandez wrote: These lines of code don't work : a = raw_input('enter number: ') b = raw_input('enter number: ') c = raw_input('enter number: ') raw_input() returns a string. So if you enter 6, say, it is stored as the character '6' not the number 6. You need to use

Re: [Tutor] (no subject)

2015-06-10 Thread Joel Goldstick
On Wed, Jun 10, 2015 at 6:36 AM, rakesh sharma rakeshsharm...@hotmail.com wrote: I have come across this syntax in python. Embedding for loop in []. How far can things be stretched using this []. l = [1, 2, 3, 4, 5] q = [i*2 for i in l] print qthanksrakesh This is called a list

Re: [Tutor] (no subject)

2015-06-10 Thread Alan Gauld
On 10/06/15 11:36, rakesh sharma wrote: I have come across this syntax in python. Embedding for loop in []. How far can things be stretched using this []. l = [1, 2, 3, 4, 5] q = [i*2 for i in l] This is a list comprehension which is a specific form of the more generalised generator

Re: [Tutor] (no subject)

2015-03-03 Thread Danny Yoo
On Mon, Mar 2, 2015 at 10:22 PM, chelse...@yahoo.com.dmarc.invalid wrote: don't understand why these execute different things… total=total+10 total=total+25 total=total+25 average=total/3 total 110 average 36.664 In your first case, what's the value of 'total'

Re: [Tutor] (no subject)

2015-03-03 Thread Danny Yoo
On Mar 3, 2015 1:49 PM, chelse...@yahoo.com wrote: i expected them to be the same because 10 plus 25 plus 25 divided by 3 is 60 and they both say that but the one that that says total=0. im just not sure how that changes the equation Please use reply to all in your email client. You might be

Re: [Tutor] (no subject)

2015-02-19 Thread Danny Yoo
On Thu, Feb 19, 2015 at 9:23 AM, rakesh sharma rakeshsharm...@hotmail.com wrote: Greetings !! Hi all, what the meaning of the line at the start of the python file __author__ = user Hi Rakesh, It's assigning a variable '__author__' with the value user. Python libraries typically have some

Re: [Tutor] (no subject)

2015-02-19 Thread Emile van Sebille
On 2/19/2015 9:23 AM, rakesh sharma wrote: Greetings !! Hi all, what the meaning of the line at the start of the python file __author__ = user Googling __author__ provides lots of relevant info. Emile ___ Tutor maillist - Tutor@python.org To

Re: [Tutor] (no subject)

2015-01-09 Thread Steven D'Aprano
On Sat, Jan 10, 2015 at 12:30:21AM -0600, Jenacee wrote: I know next to nothing about programing and I would very much like to learn how. Anything on how to get started or understanding how to start would be really great. Here you go, have fun: https://duckduckgo.com/?q=python%20tutorial

Re: [Tutor] (no subject)

2015-01-09 Thread Alan Gauld
On 10/01/15 06:30, Jenacee wrote: I know next to nothing about programing and I would very much like to learn how. Anything on how to get started or understanding how to start would be really great. There are lots of beginners tutorials on the web. This page lists some.

Re: [Tutor] (no subject)

2014-12-18 Thread Steven D'Aprano
On Thu, Dec 18, 2014 at 09:10:40PM +, Abdullahi Farah Mohamud wrote: hello i need help with a program and i dont understand what is wrong it is a lottery ticket generator. the problem is: when the computers asks the user if he would like to go again and the user says yes, it asks for the

Re: [Tutor] (no subject)

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

Re: [Tutor] (no subject)

2014-11-29 Thread Japhy Bartlett
It looks like this is a pretty common stumbling block, and you need to call `pygame.font.init()` before the code you pasted. Also.. the way you've pasted that code has added '||' all over the place. Not sure what's going on there (some sort of tabs/spaces thing?), but it makes it extremely hard

Re: [Tutor] (no subject)

2014-10-10 Thread William Becerra
It is working now. Thank you everyone. It was very helpfull. On Fri, Oct 10, 2014 at 2:36 AM, Alan Gauld alan.ga...@btinternet.com wrote: On 09/10/14 19:38, William Becerra wrote: import maths; Python, like most languages speaks American English so its math not maths. -- Alan G

Re: [Tutor] (no subject)

2014-10-09 Thread Joel Goldstick
On Oct 9, 2014 8:00 PM, William Becerra wbecer...@gmail.com wrote: I'm new to programming. Started reading the book 'How to think like a computer Scientist-learning with python'. I'm now in chapter 3 sub-chapter 3.4 Math functions. When I write the following code: import maths; import math

Re: [Tutor] (no subject)

2014-10-09 Thread Martin A. Brown
Hi there and welcome! import maths; decibel = math.log10 (17.0); angle = 1.5; height = math.sin(angle); print height; Traceback (most recent call last): File C:/Python27/test, line 1, in module import maths; ImportError: No module named maths Oops! It's a nice error report, though!

Re: [Tutor] (no subject)

2014-10-09 Thread Alan Gauld
On 09/10/14 19:38, William Becerra wrote: import maths; Python, like most languages speaks American English so its math not maths. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.flickr.com/photos/alangauldphotos

Re: [Tutor] (no subject)

2014-07-23 Thread LN A-go-go
Hi again and thank-you Wolfgang and company.  I wish I could give you snickers bars or something!  I was able to get through the road_blocks with your help.  I have been working the last few days, I am sorry to say, unsuccessfully, to calculate the mean (that's easy), split the data into

Re: [Tutor] (no subject)

2014-07-23 Thread Wolfgang Maier
On 07/23/2014 03:36 AM, LN A-go-go wrote: Hi again and thank-you Wolfgang and company. I wish I could give you snickers bars or something! I was able to get through the road_blocks with your help. I have been working the last few days, I am sorry to say, unsuccessfully, to calculate the mean

Re: [Tutor] (no subject)

2014-07-21 Thread Alan Gauld
On 21/07/14 01:34, Marc Tompkins wrote: noticed that you often advise it. I don't know who _does_ think this is a desirable pattern; I'd love to hear their argument for it - it must be really good. Nope, it doesn't need to be really good, it just needs to have enough advantage over the

Re: [Tutor] (no subject)

2014-07-21 Thread LN A-go-go
Dear Gurus, Thank-you thank-you, one more time, thank-you. I am over that hurdle and have the other: converting the list of characters that was just created by the split - into integers so I can manipulate them.  I was trying to convert to a string, then to integers.  I have been scouring the

Re: [Tutor] (no subject)

2014-07-21 Thread Wolfgang Maier
On 21.07.2014 01:48, LN A-go-go wrote: Dear Gurus, Thank-you thank-you, one more time, thank-you. I am over that hurdle and have the other: converting the list of characters that was just created by the split - into integers so I can manipulate them. I was trying to convert to a string, then

Re: [Tutor] (no subject)

2014-07-20 Thread Danny Yoo
On Sun, Jul 20, 2014 at 8:40 AM, LN A-go-go lnart...@yahoo.com.dmarc.invalid wrote: My apologies Python Gurus for repeating this request for read, write, split and append from a text file in notepad. I worked on it till late last night and will again today. I can't seem to get past trying to

Re: [Tutor] (no subject)

2014-07-20 Thread Danny Yoo
It also appears that you are trying to write whole programs at the interpreter loop. This can be inconvenient for larger programs. You might want to use a text editor or IDE to write the program as a single file, and then run Python over that program file. See:

Re: [Tutor] (no subject)

2014-07-20 Thread Marc Tompkins
On Sun, Jul 20, 2014 at 8:40 AM, LN A-go-go lnart...@yahoo.com.dmarc.invalid wrote: States OJ AK 36 AL 39 AR 39 AZ 45 CA 61 CO 54 CT 61 DC 93 DE 62 FL 51 GA 47 HI 72 IA 54 ID 36 IL 62 IN 50 KS 41 KY 41 LA 40 MA 62 MD 62 ME 58 MI 57 MN 54 MO 49 MS 43 MT 47 NC 50 ND

Re: [Tutor] (no subject)

2014-07-20 Thread Alan Gauld
On 20/07/14 21:37, Marc Tompkins wrote: Fourth (and here I differ from some of the others on this list, notably Alan G) - I don't like the while True: / break paradigm. FWIW I don't like it either, but it has become a canonical Python idiom. In fact in this case I suggested he use a for loop

Re: [Tutor] (no subject)

2014-07-20 Thread Wolfgang Maier
On 20.07.2014 17:40, LN A-go-go wrote: filename = C:/Python27/egund919/Program1/BOJ.txt myfile = open(filename,r) newfile = C:/Python27/egund919/Program1/BOJ_B.txt mynewfile = open(newfile,w) while True: line = myfile.readline() print line mynewfile.write(line) if not line:

Re: [Tutor] (no subject)

2014-07-20 Thread Wolfgang Maier
On 20.07.2014 22:37, Marc Tompkins wrote: First of all, I would take advantage of the with construction, like so: with open('C:/Python27/egund919/Program1/BOJ_B.txt','r') as infile: #do stuff with infile When the block of code inside of the with section finishes, Python will take care of

Re: [Tutor] (no subject)

2014-07-20 Thread Marc Tompkins
On Sun, Jul 20, 2014 at 2:37 PM, Alan Gauld alan.ga...@btinternet.com wrote: In fact in this case I suggested he use a for loop to iterate over the file and use a dictionary to store the results... Ah. I missed that, as I've only noticed this newer thread. And I apologize for imputing motive

Re: [Tutor] (no subject)

2014-07-20 Thread Mark Lawrence
On 21/07/2014 01:34, Marc Tompkins wrote: On Sun, Jul 20, 2014 at 2:37 PM, Alan Gauld alan.ga...@btinternet.com wrote: In fact in this case I suggested he use a for loop to iterate over the file and use a dictionary to store the results... Ah. I missed that, as I've only noticed this newer

Re: [Tutor] (no subject)

2014-07-20 Thread Marc Tompkins
On Sun, Jul 20, 2014 at 6:12 PM, Mark Lawrence breamore...@yahoo.co.uk wrote: Ah. I missed that, as I've only noticed this newer thread. And I apologize for imputing motive (a liking for while True); I'd just noticed that you often advise it. I don't know who _does_ think this is a

Re: [Tutor] (no subject)

2014-07-20 Thread Mark Lawrence
On 21/07/2014 03:05, Marc Tompkins wrote: On Sun, Jul 20, 2014 at 6:12 PM, Mark Lawrence breamore...@yahoo.co.uk wrote: Ah. I missed that, as I've only noticed this newer thread. And I apologize for imputing motive (a liking for while True); I'd just noticed that you often advise it. I

Re: [Tutor] (no subject)

2014-05-15 Thread Alan Gauld
On 15/05/14 05:57, JEAN MICHEL wrote: with open (period1.txt, 'r') as infile: for line in infile: values = line.split() name.append(values[0] + ','+ values[1]) for line in infile: values = line.split() score1=float(values[2])

Re: [Tutor] (no subject)

2014-05-15 Thread Emile van Sebille
On 5/14/2014 9:57 PM, JEAN MICHEL wrote: def calcaverage(test1,test2,test3): for count in range(test1,test2,test3): curraverage=0 curraverage=((test1[count]+ test2[count]+ test3[count])/3) currentaverage.append(curraverage) if curraverage= 90:

Re: [Tutor] (no subject)

2014-05-14 Thread Alan Gauld
On 14/05/14 21:48, JEAN MICHEL wrote: I'm a Python beginner Welcome to the list. Please always include a subject line relating to your question. It makes searching the archives much easier! I'm having difficulties writing the program so far I've been able to write up half of the

Re: [Tutor] (no subject)

2014-05-14 Thread Dave Angel
On 05/14/2014 04:48 PM, JEAN MICHEL wrote: I'm a Python beginner Welcome to python-tutor trying write a program that reads outside txt files, What's an outside txt file? And since you only one file, perhaps you left out the othertwo? takes the data like the name and test grades of

Re: [Tutor] (no subject)

2014-05-14 Thread Danny Yoo
if curraverage= 90: grade= A lettergrades.append(grade) else: if curraverage = 80 and curraverage 90: grade= B lettergrades.append(grade) else: if curraverage = 70 and

Re: [Tutor] (no subject)

2014-05-14 Thread Danny Yoo
On Wed, May 14, 2014 at 9:15 PM, Danny Yoo d...@hashcollision.org wrote: if curraverage= 90: grade= A lettergrades.append(grade) else: if curraverage = 80 and curraverage 90: grade= B

Re: [Tutor] (no subject)

2014-05-14 Thread Cameron Simpson
Before we begin, two etiquette requests: - please supply a meaningful subject line; it helps everyone keep track of the discussions; this one might have used something like help with simple grading problem - please see if your mailer (GMail?) can be told to send just plain text to this

  1   2   3   4   5   >