Re: [Tutor] Help with program

2015-02-16 Thread Peter Otten
Courtney Skinner wrote: Hello, I am trying to build a program that approximates the value of cosine - this is my program so far. It is not returning the right values. Could you tell me what I am doing wrong? def main(): import math print(This program approximates the

Re: [Tutor] Help with program

2015-02-16 Thread Mark Lawrence
On 16/02/2015 16:27, Courtney Skinner wrote: Hello, I am trying to build a program that approximates the value of cosine - this is my program so far. It is not returning the right values. Could you tell me what I am doing wrong? def main(): import math Not that it matters but

Re: [Tutor] Help with program

2015-02-16 Thread Alan Gauld
On 16/02/15 16:27, Courtney Skinner wrote: Hello, I am trying to build a program that approximates the value of cosine def main(): import math Its usual to do the imports outside the function at the tyop of the file. Python doesn't actually care much but its 'standard practice'.

Re: [Tutor] Help with program

2015-02-16 Thread Dave Angel
On 02/16/2015 11:27 AM, Courtney Skinner wrote: Hello, I am trying to build a program that approximates the value of cosine - this is my program so far. It is not returning the right values. Could you tell me what I am doing wrong? You've got several answers that point out several

Re: [Tutor] Help on Python drop-down list options

2014-12-31 Thread WolfRage
What is the user interface that your program is using, currently? IE: QT, GTK, Tkinter, Curses, Kivy, Pygame, Or None? What is the target system on which your program runs? How are you currently viewing the mean and standard deviation results? What version of Python are you using and what is

Re: [Tutor] Help on Python drop-down list options

2014-12-31 Thread Alan Gauld
On 31/12/14 13:49, Tammy Miller wrote: I need help on the following: I have a created a project from a csv file to calculate the mean and standard deviation. I assume that means you read the data from the CSV file and display the stats? However, I would like to create a drop-down list and

Re: [Tutor] help with tic-tac-toe program

2014-11-18 Thread Jan Erik Moström
If I understand what you're asking you need to write the current gameboard and the info you get in 'gameBoard' is the current state of the game. There are several ways of doing this (with different degrees of cleverness) but to keep it simple: Start by printing out the current state, different

Re: [Tutor] help with tic-tac-toe program

2014-11-16 Thread Joel Goldstick
On Sun, Nov 16, 2014 at 1:52 PM, Andrew McReynolds amcreynol...@yahoo.com.dmarc.invalid wrote: The section of the assignment that I'm working on states: 2) Write a function called loadGameBoard (player_marks) where player_marks is a dictionary that contains the players’ marks. This function

Re: [Tutor] Help understanding classes

2014-11-15 Thread Bo Morris
Thank you Alan and Danny. It amazes me at the lengths you guys, as well as everyone else who contributes, will go to to help explain things to us; it is greatly appreciated! Alan, I decided to dumb down the learning classes just a little. By this I mean, I am not using Tkinter to learn

Re: [Tutor] Help understanding classes

2014-11-15 Thread Alan Gauld
On 15/11/14 18:19, Bo Morris wrote: With the first part… class Message: def __init__(self, aString): self.text = aString Will I always use “_init_” when defining the first function in a class? It can go anywhere in the class definition. it is just another method of the class.

Re: [Tutor] Help understanding classes

2014-11-15 Thread Steven D'Aprano
On Sat, Nov 15, 2014 at 06:19:56PM +, Bo Morris wrote: Thank you Alan and Danny. It amazes me at the lengths you guys, as well as everyone else who contributes, will go to to help explain things to us; it is greatly appreciated! Alan, I decided to dumb down the learning classes just a

Re: [Tutor] Help understanding classes

2014-11-14 Thread Alan Gauld
On 15/11/14 00:29, Bo wrote: help understanding classes and how they work. What is the point in OOP if I don’t understand classes, are classes not the heart and soul of OOP? Actually not necessarily. There are OOP languages where classes are not included or little used. Javascript is a good

Re: [Tutor] Help understanding classes

2014-11-14 Thread Danny Yoo
On Fri, Nov 14, 2014 at 4:29 PM, Bo crushe...@gmail.com wrote: Hello everyone, hope all is well. Was just wondering if I could get some help understanding classes and how they work. What is the point in OOP if I don’t understand classes, are classes not the heart and soul of OOP? I have been

Re: [Tutor] Help with Dice game

2014-11-11 Thread Dave Angel
corylog...@yahoo.com.dmarc.invalid Wrote in message: !-- p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph { margin-top:0in; margin-right:0in; margin-bottom:0in; margin-left:.5in; margin-bottom:.0001pt; } p.MsoNormal, li.MsoNormal, div.MsoNormal { margin:0in;

Re: [Tutor] Help with Dice game

2014-11-10 Thread Alan Gauld
On 10/11/14 20:57, corylog...@yahoo.com.dmarc.invalid wrote: I wrote the following code as a simulation for the table top game x-wing. I don;t know it so can only give some general comments below... import random print(X-wing dice simulator) x = int(input(How many dice will the offensive

Re: [Tutor] Help with Dice game

2014-11-10 Thread Lifeng Lin
I am not familiar with the game, but maybe using offense += 1 and defense += 1 to replace the corresponding continue would help? On Mon, Nov 10, 2014 at 2:57 PM, corylog...@yahoo.com.dmarc.invalid wrote: Hello, I can not for the life of me figure out where I have gone wrong. I wrote the

Re: [Tutor] Help with running an API

2014-10-26 Thread Anish Tambe
The usage of the api as documented here - https://github.com/zachwill/fred - suggests : import fred # Save your FRED API key. fred.key('my_fred_api_key') # Interact with economic data categories. fred.category() ... Cheers, Anish Tambe On 26 Oct 2014 00:23, Joel Goldstick

Re: [Tutor] Help with running an API

2014-10-25 Thread Alan Gauld
On 25/10/14 17:08, Mark Meanwell wrote: Hi Folks - new to python and trying to run an API. Running version 2.7.3. on Windows 7 machine. Here is the scenario for the given API (FRED API in this case): easy_install Fred from C:\ - this installs to C:\site packages then I fire up the python

Re: [Tutor] Help with running an API

2014-10-25 Thread Joel Goldstick
On Sat, Oct 25, 2014 at 12:08 PM, Mark Meanwell mmeanw...@gmail.com wrote: Hi Folks - new to python and trying to run an API. Running version 2.7.3. on Windows 7 machine. Here is the scenario for the given API (FRED API in this case): easy_install Fred from C:\ - this installs to C:\site

Re: [Tutor] Help with guess my number game

2014-10-13 Thread Danny Yoo
if guess != the_number: print (you failed, the number was, the_number) elif guess==the_number: print(You guessed it! The number was, the_number) print(And it only took you, tries, tries!\n) This block of code appears to be applied for every iteration

Re: [Tutor] Help with guess my number game

2014-10-13 Thread Alan Gauld
On 13/10/14 11:40, אופיר לירון wrote: # set the initial values the_number = random.randint(1, 100) guess = int(input(Take a guess: )) tries = 1 # guessing loop while guess != the_number: if guess the_number: print(Lower...) else: print(Higher...) guess =

Re: [Tutor] Help

2014-09-20 Thread diliup gabadamudalige
http://cscircles.cemc.uwaterloo.ca/run-at-home/ On Fri, Sep 19, 2014 at 11:04 AM, Danny Yoo d...@hashcollision.org wrote: On Wed, Sep 17, 2014 at 4:36 PM, Art Pelletier artp...@gmail.com wrote: I am a beginner with pythons programming I would like to see if their is a site that has

Re: [Tutor] Help

2014-09-18 Thread C Smith
Check this guy's youtube channel. He has very basic examples. His username is thenewboston On Wed, Sep 17, 2014 at 4:36 PM, Art Pelletier artp...@gmail.com wrote: I am a beginner with pythons programming I would like to see if their is a site that has samples programs that I can practice

Re: [Tutor] Help

2014-09-18 Thread Danny Yoo
On Wed, Sep 17, 2014 at 4:36 PM, Art Pelletier artp...@gmail.com wrote: I am a beginner with pythons programming I would like to see if their is a site that has samples programs that I can practice on. Hi Art, Yes, there are some good resources you can check out. Here's a link to some of

Re: [Tutor] Help on best way to check resence of item inside list

2014-05-27 Thread Mark Lawrence
On 27/05/2014 09:05, jarod...@libero.it wrote: Dear All clubA= [mary,luke,amyr,marco,franco,lucia, sally,genevra, electra] clubB= [mary,rebecca,jane,jessica,judit,sharon,lucia, sally, Castiel,Sam] I have a list of names that I would to annotate in function of presence in different clubs: my

Re: [Tutor] Help on best way to check resence of item inside list

2014-05-27 Thread Dave Angel
jarod...@libero.it jarod...@libero.it Wrote in message: Dear All clubA= [mary,luke,amyr,marco,franco,lucia, sally,genevra, electra] clubB= [mary,rebecca,jane,jessica,judit,sharon,lucia, sally, Castiel,Sam] I have a list of names that I would to annotate in function of presence in

Re: [Tutor] Help on best way to check resence of item inside list

2014-05-27 Thread Steven D'Aprano
On Tue, May 27, 2014 at 10:05:30AM +0200, jarod...@libero.it wrote: [...] with open(file.in) as p: mit = [] You have lost the indentation, which makes this code incorrect. But the rest of the code is too complicated. for i in p: lines =i.strip(\n).split(\t) if (lines[0] in clubA:

Re: [Tutor] Help on best way to check resence of item inside list

2014-05-27 Thread Peter Otten
jarod...@libero.it wrote: Dear All clubA= [mary,luke,amyr,marco,franco,lucia, sally,genevra, electra] clubB= [mary,rebecca,jane,jessica,judit,sharon,lucia, sally, Castiel,Sam] I have a list of names that I would to annotate in function of presence in different clubs: my input files

Re: [Tutor] Help with Python

2014-05-16 Thread Alan Gauld
On 16/05/14 02:58, Glen Chan wrote: Hello, I am student trying to fugure out why when I enter any number it says error. Because that's what you programmed it to do. Almost. If you enter 1 or 10 you won't get an error. Look at your logic: number = input('Enter a number between 1 and 10: ')

Re: [Tutor] Help with Python

2014-05-16 Thread Steven D'Aprano
Hi Glen, and welcome! My responses below. On Thu, May 15, 2014 at 09:58:07PM -0400, Glen Chan wrote: Hello, I am student trying to fugure out why when I enter any number it says error. It's only suppose to do that if it's out the 1-10 range. Please help. Thank you. You've made an mistake

Re: [Tutor] Help with Python

2014-05-12 Thread jitendra gupta
Hi This will solve your purpose: Yes we can write in better way also : -- #The Dice Game #add libraries needed import random #the main function def main(): print #initialize variables playerOne = 'No Name' playerTwo = 'No Name' endProgram =no

Re: [Tutor] Help with Python

2014-05-11 Thread C Smith
Hey Glen, include the error you are getting. It will make answering your question easier. How are you running this program, in an IDE? On Sat, May 10, 2014 at 11:16 PM, Glen Chan gchan...@msn.com wrote: Hello, I am a student trying to figure out Python. I am getting errors that I don't know how

Re: [Tutor] Help with Python

2014-05-11 Thread Alan Gauld
On 11/05/14 04:16, Glen Chan wrote: Hello, I am a student trying to figure out Python. I am getting errors that I don't know how to fix. What do you do after you get the error message and something is highlighted? Does that have to be deleted? The error doesn't need to be deleted because it

Re: [Tutor] Help with Python

2014-05-11 Thread Dave Angel
On 05/10/2014 11:16 PM, Glen Chan wrote: Hello, I am a student trying to figure out Python. I am getting errors that I don't know how to fix. What do you do after you get the error message and something is highlighted? Does that have to be deleted? Anyway, here is what I mean... def main():

Re: [Tutor] HELP! How do I remove the black after s=

2014-05-10 Thread Chris “Kwpolska” Warrick
On Sat, May 10, 2014 at 8:35 AM, 1 2 bothe...@gmail.com wrote: In the result it shows s= 8 pls tell me how to remove the blank? s,t,n = 0,0,1 while t = s: s,t,n = s+2,t+n,n+1 else: print('s=',s,n) You must use something else. For example: print('s={0} {1}'.format(s, n)) This

Re: [Tutor] HELP! How do I remove the black after s=

2014-05-10 Thread Alan Gauld
On 10/05/14 07:35, 1 2 wrote: In the result it shows s= 8 pls tell me how to remove the blank? s,t,n = 0,0,1 while t = s: s,t,n = s+2,t+n,n+1 else: print('s=',s,n) Assuming you are using Python version 3 you need to specify the sep option to print: print('s=',s,n,sep='')

Re: [Tutor] HELP! How do I remove the black after s=

2014-05-10 Thread Steven D'Aprano
Hello 1 2, and welcome! (By the way, I feel quite silly calling you by the name you show in your email address. Do you have another name you would prefer to be known by?) My response below. On Sat, May 10, 2014 at 02:35:07PM +0800, 1 2 wrote: In the result it shows s= 8 pls tell me how to

Re: [Tutor] Help With Code

2014-05-04 Thread Alan Gauld
On 01/05/14 01:18, jordan smallwood wrote: Hey there, I have this code below (in to cm conversion) and I want to have the user try again if they enter in a non integer. What am I missing: A loop. There is a common pattern or idiom in Pytthon: while True: get input if input ok:

Re: [Tutor] Help With Code

2014-05-04 Thread Dave Angel
jordan smallwood jsmallwoo...@yahoo.com.dmarc.invalid Wrote in message: want to have the user try again if they enter in a non integer. What am I missing: Do you perhaps mean float? If so, see the other response. -- DaveA ___ Tutor

Re: [Tutor] Help needed

2014-04-26 Thread Alan Gauld
On 26/04/14 01:46, Suhana Vidyarthi wrote: I have this file: 1,3,5,0.03 2,3,5,5,4,0.11 3,3,5,5,4,5,8,0.04 And each line is interpreted as: * 1,3,5,0.03- This line means 1 link can be down i.e. between 3—5 with a probability of failure *0.03* * 2,3,5,5,4,0.11 - This line means

Re: [Tutor] Help needed

2014-04-26 Thread Danny Yoo
Hi Suhana, Also note that you asked this question just a few days ago. https://mail.python.org/pipermail/tutor/2014-April/101019.html We're not robots. We don't like repetition unless there's a reason for it, and in this case, you got responses to the earlier question. For example:

Re: [Tutor] Help needed

2014-04-26 Thread Suhana Vidyarthi
Hi, The reason I opened a link is because there are changes in the code. Does it make sense? Else I can definitely go back to the thread. On Sat, Apr 26, 2014 at 9:05 AM, Danny Yoo d...@hashcollision.org wrote: Hi Suhana, Also note that you asked this question just a few days ago.

Re: [Tutor] Help needed

2014-04-26 Thread Suhana Vidyarthi
Thanks for the response Alan. my clarifications are below: On Sat, Apr 26, 2014 at 1:41 AM, Alan Gauld alan.ga...@btinternet.comwrote: On 26/04/14 01:46, Suhana Vidyarthi wrote: I have this file: 1,3,5,0.03 2,3,5,5,4,0.11 3,3,5,5,4,5,8,0.04 And each line is interpreted as:

Re: [Tutor] Help needed

2014-04-26 Thread Danny Yoo
I want to create two arrays using the above file (Links array and Prob array) that should give following output: *Links *= { [3,5] [5,4] [5,8] [7,8] [14,10] [14,13] [17,13] [14,18] [10,13] [14,13] [17,13] [12,13] [11,6] [11,9][11,12] [11,19] [19,20] [15,20] [21,20] [20,21] [21,16] [21,22] }

Re: [Tutor] Help needed

2014-04-26 Thread Suhana Vidyarthi
Hi Danny, Let me give you a high level brief of what I am doing: I am working on doing disaster aware routing considering the 24-node US network where I will be setting up connection between two any two nodes (I will select the source and destination nodes randomly). Also I have some links whose

Re: [Tutor] Help needed

2014-04-26 Thread C Smith
Just glancing at your work, I see you have curly braces around what looks like it should be a list. If you are concerned with the order of your output, dictionaries do not have a concept of order. On Sat, Apr 26, 2014 at 3:16 PM, Suhana Vidyarthi suhanavidyar...@gmail.com wrote: Hi Danny,

Re: [Tutor] Help needed

2014-04-26 Thread C Smith
err, set also is unordered. I can see you are using set for a reason, but has no concept of order. On Sat, Apr 26, 2014 at 3:20 PM, C Smith illusiontechniq...@gmail.comwrote: Just glancing at your work, I see you have curly braces around what looks like it should be a list. If you are

Re: [Tutor] Help needed

2014-04-26 Thread Suhana Vidyarthi
Thanks for the response Smith, I was thinking make be I have done something incorrect and if there is some other function that can be used to display the output in desired order but don't see it possible thats why was wondering if any of you Python gurus have any inputs for me :-) On Sat, Apr

Re: [Tutor] Help needed

2014-04-26 Thread C Smith
As others have pointed out, a mapping/dictionary or just a list of lists seems like how you would want to organize the data for input. I think your problem is insistence on using sets. I am no Python guru, but I think this list is more for exploratory learning of Python. I think people are trying

Re: [Tutor] Help With an Assignment

2014-04-25 Thread Alan Gauld
On 25/04/14 20:52, jordan smallwood wrote: Hello, I am new to Python. I mean completely new and we're working on this problem set where they give us specs and we have to build something based off these specs. I have no idea what they're asking. Its pretty clear. They want you to build a

Re: [Tutor] Help With an Assignment

2014-04-25 Thread Dave Angel
jordan smallwood jsmallwoo...@yahoo.com.dmarc.invalid Wrote in message: Do you know what a module is? Can you use a text editor to create one? Do you know what a function looks like? Try writing the first one they asked. Post it here, along with some test code showing it works, or describe

Re: [Tutor] Help needed with Python programming

2014-04-22 Thread Alan Gauld
On 22/04/14 02:16, Suhana Vidyarthi wrote: I have a python code that shows a set of shortest paths between nodes A and B. It would help if you showed us this code. Otherwise we are just making wild guesses about how you are modelling this. Also knowing which Python version you are using

Re: [Tutor] Help needed with Python programming

2014-04-22 Thread Steven D'Aprano
On Mon, Apr 21, 2014 at 06:16:20PM -0700, Suhana Vidyarthi wrote: [...] I have a python code that shows a set of shortest paths between nodes A and B. Now I have to select the least risky path among them. To do that I have to consider the risk values of each link. I know how to calculate the

Re: [Tutor] Help needed with Python programming

2014-04-22 Thread Mark Lawrence
On 22/04/2014 12:41, Steven D'Aprano wrote: On Mon, Apr 21, 2014 at 06:16:20PM -0700, Suhana Vidyarthi wrote: [...] # on Windows either of these will be okay filename = C:/path/to/file.txt filename = C:\\path\\to\\file.txt Or a raw string r'C:\path\to\file.txt' -- My fellow

Re: [Tutor] Help needed with Python programming

2014-04-22 Thread Danny Yoo
Unfortunately, we can't give too much specific help on your particular problem because it's homework. You should use the knowledge you learned in your introductory programming class about designing programs. In particular, give a name to the function or functions your are designing. Be rigorous

Re: [Tutor] Help Noob Question

2014-03-28 Thread spir
On 03/28/2014 02:17 AM, Alan Gauld wrote: On 27/03/14 21:01, Chris “Kwpolska” Warrick wrote: On Mar 27, 2014 8:58 PM, Alan Gauld alan.ga...@btinternet.com mailto:alan.ga...@btinternet.com wrote: On 27/03/14 06:43, Leo Nardo wrote: Im on windows 8 and i need to open a file called

Re: [Tutor] Help Noob Question

2014-03-28 Thread Mark Lawrence
On 28/03/2014 01:17, Alan Gauld wrote: On 27/03/14 21:01, Chris “Kwpolska” Warrick wrote: On Mar 27, 2014 8:58 PM, Alan Gauld alan.ga...@btinternet.com mailto:alan.ga...@btinternet.com wrote: On 27/03/14 06:43, Leo Nardo wrote: Im on windows 8 and i need to open a file called string1.py

Re: [Tutor] Help Noob Question

2014-03-28 Thread Alan Gauld
On 28/03/14 09:28, spir wrote: On 03/28/2014 02:17 AM, Alan Gauld wrote: you have to remember where it is. There is no ~ shortcut in Windows. On my system that means typing something like: C:\Documents and Settings\alang\Desktop Can't you make a symlink pointing to Desktop? (in C:\ or

Re: [Tutor] Help Noob Question

2014-03-28 Thread Chris “Kwpolska” Warrick
On Fri, Mar 28, 2014 at 2:17 AM, Alan Gauld alan.ga...@btinternet.com wrote: On 27/03/14 21:01, Chris “Kwpolska” Warrick wrote: Painful? How painful can `cd Desktop` be? Certainly less than `D:` followed by `cd PythonProjects`… Because the desktop is hardly ever anywhere near where the cmd

Re: [Tutor] Help Noob Question

2014-03-28 Thread Walter Prins
Hi Leo, On 27 March 2014 08:43, Leo Nardo waterfallr...@gmail.com wrote: Im on windows 8 and i need to open a file called string1.py that is on my desktop, in both the interpreter and notepad++, so that i can work on it. I already have it open in notepad, but for the life of me cannot figure

Re: [Tutor] Help Noob Question

2014-03-28 Thread David Rock
* Chris “Kwpolska” Warrick kwpol...@gmail.com [2014-03-28 16:27]: Create a folder on the desktop, or even in the home directory. A much nicer place than the drive root — and a much modern way to store it (drive root sounds DOS-y) I'll have to disagree with this statement. Dropping all your

Re: [Tutor] Help Noob Question

2014-03-28 Thread Alan Gauld
On 28/03/14 15:27, Chris “Kwpolska” Warrick wrote: On Fri, Mar 28, 2014 at 2:17 AM, Alan Gauld alan.ga...@btinternet.com wrote: Because the desktop is hardly ever anywhere near where the cmd prompt lands you. I just tested on my Windows 7 box. It got me to C:\Users\Kwpolska. `cd Desktop`

Re: [Tutor] Help Noob Question

2014-03-27 Thread David Palao
Hello, What do you mean by open it in the interpreter? Do you want to open it and read from it its content? or do you want to execute its python code within the interpreter? Best 2014-03-27 7:43 GMT+01:00 Leo Nardo waterfallr...@gmail.com: Im on windows 8 and i need to open a file called

Re: [Tutor] Help Noob Question

2014-03-27 Thread Mark Lawrence
On 27/03/2014 08:55, David Palao wrote: Hello, What do you mean by open it in the interpreter? Do you want to open it and read from it its content? or do you want to execute its python code within the interpreter? Best 2014-03-27 7:43 GMT+01:00 Leo Nardo waterfallr...@gmail.com: Im on windows

Re: [Tutor] Help Noob Question

2014-03-27 Thread Ben Finney
Leo Nardo waterfallr...@gmail.com writes: Im on windows 8 and i need to open a file called string1.py that is on my desktop, in both the interpreter and notepad++, so that i can work on it. It's not clear what you want. What does it mean to you for a Python program to be “open in the

Re: [Tutor] Help Noob Question

2014-03-27 Thread Dave Angel
Leo Nardo waterfallr...@gmail.com Wrote in message Im on windows 8 and i need to open a file called string1.py that is on my desktop, in both the interpreter and notepad++, so that i can work on it. I already have it open in notepad, but for the life of me cannot figure out how to open it

Re: [Tutor] Help Noob Question

2014-03-27 Thread Alan Gauld
On 27/03/14 06:43, Leo Nardo wrote: Im on windows 8 and i need to open a file called string1.py that is on my desktop, Thats your first problem. Its usually a bad idea to store your python code on the desktop, because the desktop is a pain to find from a command line. Instead create a

Re: [Tutor] Help Noob Question

2014-03-27 Thread Chris “Kwpolska” Warrick
On Mar 27, 2014 8:58 PM, Alan Gauld alan.ga...@btinternet.com wrote: On 27/03/14 06:43, Leo Nardo wrote: Im on windows 8 and i need to open a file called string1.py that is on my desktop, Thats your first problem. Its usually a bad idea to store your python code on the desktop, because the

Re: [Tutor] Help Noob Question

2014-03-27 Thread Mark Lawrence
On 27/03/2014 19:56, Alan Gauld wrote: On 27/03/14 06:43, Leo Nardo wrote: Im on windows 8 and i need to open a file called string1.py that is on my desktop, Thats your first problem. Its usually a bad idea to store your python code on the desktop, because the desktop is a pain to find from a

Re: [Tutor] Help Noob Question

2014-03-27 Thread Alan Gauld
On 27/03/14 21:01, Chris “Kwpolska” Warrick wrote: On Mar 27, 2014 8:58 PM, Alan Gauld alan.ga...@btinternet.com mailto:alan.ga...@btinternet.com wrote: On 27/03/14 06:43, Leo Nardo wrote: Im on windows 8 and i need to open a file called string1.py that is on my desktop, Thats

Re: [Tutor] help

2014-03-18 Thread Joel Goldstick
List On Mar 18, 2014 11:08 AM, y j yashp...@gmail.com wrote: how can i split a word into letters in python 2.7.6? -- Y D Jain ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options:

Re: [Tutor] help

2014-03-18 Thread Alan Gauld
On 18/03/14 18:21, Joel Goldstick wrote: List On Mar 18, 2014 11:08 AM, y j yashp...@gmail.com mailto:yashp...@gmail.com wrote: how can i split a word into letters in python 2.7.6? or more specifically list(aString) - lowercase and with params. That will give you a list of the

Re: [Tutor] Help with Guess the number script

2014-03-12 Thread Scott W Dunning
On Mar 11, 2014, at 7:50 PM, William Ray Wing w...@mac.com wrote: Simple. In Mail Preferences - Composing - Message Format - Plain Text (Your setting is probably currently Rich Text.) Got it, hopefully that helps. ___ Tutor maillist -

Re: [Tutor] Help with Guess the number script

2014-03-12 Thread Scott Dunning
On Mar 11, 2014, at 1:57 AM, Alan Gauld alan.ga...@btinternet.com wrote: OK so far, you don't need all the print statements but that's just a style issue. (You could just insert '\n' characters instead.) You’re right, I’m actually not sure why I did it that way. if guess secret - 10

Re: [Tutor] Help with Guess the number script

2014-03-12 Thread Scott Dunning
On Mar 10, 2014, at 11:18 PM, Dave Angel da...@davea.name wrote: if guess secret - 10 or guess secret - 10: Think about that line. You might even want to put in a separate function to test what it does. HINT: it's wrong. Got it! I realized what I was doing wrong. I needed that

Re: [Tutor] Help with Guess the number script

2014-03-12 Thread spir
On 03/12/2014 05:13 AM, Scott Dunning wrote: if guess secret - 10 or guess secret - 10: This is the right idea for cutting the line count but you have the comparison values wrong. Look back to earlier emails, you are repeating the same error as before. Manually think through what

Re: [Tutor] Help with Guess the number script

2014-03-12 Thread Dave Angel
Scott W Dunning scott@cox.net Wrote in message: On Mar 11, 2014, at 7:50 PM, William Ray Wing w...@mac.com wrote: Simple. In Mail Preferences - Composing - Message Format - Plain Text (Your setting is probably currently Rich Text.) Got it, hopefully that helps. Perfect, thanks.

Re: [Tutor] Help with Guess the number script

2014-03-12 Thread Danny Yoo
Such errors are either obvious or invisible. A remedy is often to figure the problem on paper (or in your head if you're good at thinking visually). Here, just draw a line segment with secret in the middle and the interval borders around. Then, write there on the drawing the _values_ of the

Re: [Tutor] Help with Guess the number script

2014-03-11 Thread Dave Angel
Scott W Dunning swdunn...@cox.net Wrote in message: Would you please stop posting in html? def print_hints(secret, guess):     if guess 1 or guess 100:         print         print Out of range!         print     if guess secret:         print         print Too

Re: [Tutor] Help with Guess the number script

2014-03-11 Thread Scott W Dunning
On Mar 10, 2014, at 11:18 PM, Dave Angel da...@davea.name wrote: Scott W Dunning swdunn...@cox.net Wrote in message: Would you please stop posting in html? I don’t know what you mean? I just use the text for my email provider. It’s not html? I types up the code I had in the

Re: [Tutor] Help with Guess the number script

2014-03-11 Thread Scott W Dunning
On Mar 10, 2014, at 11:18 PM, Dave Angel da...@davea.name wrote: Where are you guys using the forum? Through google? I was using that at first but someone complained about something that google does and told me to get it through my email. That’s what I’m doing now and I get bombarded with

Re: [Tutor] Help with Guess the number script

2014-03-11 Thread Alan Gauld
On 11/03/14 07:42, Scott W Dunning wrote: On Mar 10, 2014, at 11:18 PM, Dave Angel da...@davea.name wrote: Where are you guys using the forum? Personally I use the news feed from Gmane.org I read it in Thunderbird (or occasionally via a newsreader on my smartphone/tablet). You can also read

Re: [Tutor] Help with Guess the number script

2014-03-11 Thread Alan Gauld
On 11/03/14 04:07, Scott W Dunning wrote: On Mar 8, 2014, at 3:57 AM, spir denis.s...@gmail.com mailto:denis.s...@gmail.com wrote: And now that you have the right set of tests you can half the number of lines by combining your if conditions again, like you had in the original post. ie. Bring

Re: [Tutor] Help with Guess the number script

2014-03-11 Thread spir
On 03/11/2014 04:32 AM, Scott W Dunning wrote: On Mar 8, 2014, at 11:50 AM, Scott dunning swdunn...@cox.net wrote: And now that you have the right set of tests you can half the number of lines by combining your if conditions again, like you had in the original post. ie. Bring your

Re: [Tutor] Help with Guess the number script

2014-03-11 Thread spir
On 03/11/2014 09:57 AM, Alan Gauld wrote: On 11/03/14 04:07, Scott W Dunning wrote: On Mar 8, 2014, at 3:57 AM, spir denis.s...@gmail.com mailto:denis.s...@gmail.com wrote: And now that you have the right set of tests you can half the number of lines by combining your if conditions again, like

Re: [Tutor] Help with Guess the number script

2014-03-11 Thread spir
On 03/11/2014 05:07 AM, Scott W Dunning wrote: On Mar 8, 2014, at 3:57 AM, spir denis.s...@gmail.com wrote: Well done. And now that you have the right set of tests you can half the number of lines by combining your if conditions again, like you had in the original post. ie. Bring your

Re: [Tutor] Help with Guess the number script

2014-03-11 Thread Scott W Dunning
On Mar 11, 2014, at 1:49 AM, Alan Gauld alan.ga...@btinternet.com wrote: Not from the tutor list though. It only has a few mails normally - less than 50 most days. Actually now that you say that most of the emails are coming through the reg python-lists, not the tutor section. I guess I

Re: [Tutor] Help with Guess the number script

2014-03-11 Thread William Ray Wing
On Mar 11, 2014, at 8:06 PM, Scott W Dunning swdunn...@cox.net wrote: [mega byte] Yeah, I had no idea that my messages were coming through in HTML, nor what it looked like until someone sent me a section showing me what it looked like, I can see how that would be frustrating. I’m

Re: [Tutor] Help with Guess the number script

2014-03-10 Thread Scott W Dunning
On Mar 8, 2014, at 7:29 AM, eryksun eryk...@gmail.com wrote: i.e. guess 1 or guess 100 becomes not not (guess 1 or guess 100) Why a not not? Wouldn’t that just be saying do this because the second not is undoing the first? distribute over the disjunction not (not

Re: [Tutor] Help with Guess the number script

2014-03-10 Thread Scott W Dunning
On Mar 8, 2014, at 7:35 AM, Mark Lawrence breamore...@yahoo.co.uk wrote: I have no interest in the efficiency, only what is easiest for me to read, which in this case is the chained comparison. As a rule of thumb I'd also prefer it to be logically correct :) What exactly is ment by a

Re: [Tutor] Help with Guess the number script

2014-03-10 Thread Mark Lawrence
On 10/03/2014 02:05, Scott W Dunning wrote: On Mar 8, 2014, at 7:35 AM, Mark Lawrence breamore...@yahoo.co.uk wrote: I have no interest in the efficiency, only what is easiest for me to read, which in this case is the chained comparison. As a rule of thumb I'd also prefer it to be

Re: [Tutor] Help with Guess the number script

2014-03-10 Thread Mark Lawrence
On 10/03/2014 02:03, Scott W Dunning wrote: On Mar 8, 2014, at 7:29 AM, eryksun eryk...@gmail.com wrote: Anyway, you needn't go out of your way to rewrite the expression using a chained comparison. The disjunctive expression is actually implemented more efficiently by CPython's compiler, which

Re: [Tutor] Help with Guess the number script

2014-03-10 Thread eryksun
On Mon, Mar 10, 2014 at 5:29 AM, Mark Lawrence breamore...@yahoo.co.uk wrote: As a newbie don't worry about it (yet). Personally I think it's plain daft to put such advanced language topics on a tutor mailing list. Different strokes for different folks. I like to tinker with and disassemble

Re: [Tutor] help me

2014-03-10 Thread hind fathallah
hi I need your help plz with this cods ( I want u to  tell wht cod I miss to stop the while loop whene I get 3 stars)  rm = [] stars = 0 ##if stars == 3: ##    print You win ##else: ##    print hh def ask_yes_no(question):     Ask a yes or no question.     answer = None        while answer not

Re: [Tutor] help me

2014-03-10 Thread Dave Angel
hind fathallah hind_fathal...@yahoo.com Wrote in message: while rm != stars:         print\                 0 - Northe         1 - South         2 - East         3 - Weast                 rm = raw_input(What room you want to go?: ) Why are you looping till

Re: [Tutor] help me

2014-03-10 Thread Peter Otten
hind fathallah wrote: hi I need your help plz with this cods ( I want u to tell wht cod I miss to stop the while loop whene I get 3 stars) rm = [] I think you are comparing a string and an integer. That gives False even if the values look the same: i = 3 s = 3 print i, s 3 3 i == s

Re: [Tutor] Help with Guess the number script

2014-03-10 Thread Scott W Dunning
On Mar 10, 2014, at 4:15 AM, eryksun eryk...@gmail.com wrote: Different strokes for different folks. I like to tinker with and disassemble things as I'm learning about them. I would have been ecstatic about open source as a kid. I learn simultaneously from the top down and bottom up --

Re: [Tutor] Help with Guess the number script

2014-03-10 Thread Scott W Dunning
On Mar 8, 2014, at 3:57 AM, spir denis.s...@gmail.com wrote: Well done. And now that you have the right set of tests you can half the number of lines by combining your if conditions again, like you had in the original post. ie. Bring your hot/cold/warm tests together. So below is what I

Re: [Tutor] Help with Guess the number script

2014-03-10 Thread Scott W Dunning
On Mar 8, 2014, at 11:50 AM, Scott dunning swdunn...@cox.net wrote: And now that you have the right set of tests you can half the number of lines by combining your if conditions again, like you had in the original post. ie. Bring your hot/cold/warm tests together. I’m having a hard time

Re: [Tutor] Help with Guess the number script

2014-03-09 Thread eryksun
On Mar 8, 2014, at 7:29 AM, eryksun eryk...@gmail.com wrote: not not (guess 1 or guess 100) Why a not not? Wouldn’t that just be saying do this because the second not is undoing the first? In boolean algebra, `not (A or B)` is equivalent to `not A and not B` (De Morgan's law). I

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