Re: [Tutor] Coding

2014-12-07 Thread Steven D'Aprano
On Mon, Dec 08, 2014 at 01:47:39AM +, Alan Gauld wrote: > > FirstChoice = input ("Enter the item of your choice: ") > > if FirstChoice == 'Coke' or 'Pepsi' or 'Water': > >print ("That will be a total of £",drinks) > > The or statements don't do what you think. > > Python sees it like: >

Re: [Tutor] getting input for stdin

2014-12-07 Thread Alan Gauld
On 07/12/14 17:38, diliup gabadamudalige wrote: if __name__ == '__main__': You don't really need that unless your code can be treated as a module, which yours can't. p = os.getcwd() filename = "\get scale of choice.txt" filepath = p + filename sys.stdout = open(filepath,

Re: [Tutor] Coding

2014-12-07 Thread Danny Yoo
On Sun, Dec 7, 2014 at 7:27 AM, Awais Idris <2010-3...@slougheton.com> wrote: > Hi there, I'm currently in secondary school yr 11 studying the computing > course and I've been set a task in creating a vending machine code. I found > some coding online and I have changed some of it, but it still doe

Re: [Tutor] getting input for stdin

2014-12-07 Thread Danny Yoo
> I need to get the stdin input from the text I type into the same text file > that I have stdout at. How do I do that. None of the answers at > stackoverflow got me going. Any help on a code snippet would be appreciated. In-place edits of a file are dangerous, especially as a beginner. This is be

Re: [Tutor] Coding

2014-12-07 Thread Alan Gauld
On 07/12/14 15:27, Awais Idris wrote: found some coding online and I have changed some of it, but it still doesn't work. I think theres a problem with the loops and a few other things that I cant put my finger on. First, Please post the code into your message rather than as an attachment. Its

[Tutor] getting input for stdin

2014-12-07 Thread diliup gabadamudalige
Dear alll, my code is given below if __name__ == '__main__': p = os.getcwd() filename = "\get scale of choice.txt" filepath = p + filename sys.stdout = open(filepath, "w") os.startfile(filepath) for i in data.info: # print all the scale info to window print i

Re: [Tutor] Need a little help in formatting print statement

2014-12-07 Thread Anubhav Yadav
> If your code is short enough, say, less than 50 lines, please include it > directly in your email. Some of us are reading and replying to posts at > a time where it is inconvenient to access the web, or at least parts of > the web. > > Yes sure, next time I will keep that in mind. > Try using t

[Tutor] Coding

2014-12-07 Thread Awais Idris
Hi there, I'm currently in secondary school yr 11 studying the computing course and I've been set a task in creating a vending machine code. I found some coding online and I have changed some of it, but it still doesn't work. I think theres a problem with the loops and a few other things that I can

Re: [Tutor] Need a little help in formatting print statement

2014-12-07 Thread Steven D'Aprano
Hello Anubhav and welcome! On Sun, Dec 07, 2014 at 07:54:53PM +0530, Anubhav Yadav wrote: > I am trying to solve the CS1 Python > Exercises. > > The first exercise calculates the energy released from an earthquake based > on it's ritch

[Tutor] Python Projects

2014-12-07 Thread Bo Morris
The book arrived this morning. Thanks Alan! Bo ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] Need a little help in formatting print statement

2014-12-07 Thread Anubhav Yadav
I am trying to solve the CS1 Python Exercises. The first exercise calculates the energy released from an earthquake based on it's ritcher scale. I wrote the code. Here is the code. I am supposed to get th