Hello Sir, I'm trying to write a program that checks for the square root of any number input by the User. It's a fairly simple coding though atleast for an ambitious beginner.
I want the code to first, calculate the square root and the tell the user whether or not. It should end up telling the User that this is a perfect square. Below is the coding: print('Check for a perfect square') number = int(input('Which number are you checking for? ')) square = (number)**(1/2.0) print('Square Root is = %.2f'%(square)) I am trying to put in something like: if square (is perfect square): print ('This is a perfect square') Pls Help. Thanks. On 5/21/10, ALAN GAULD <alan.ga...@btinternet.com> wrote: > I suspect the likely cause is that you need to change directory to the > directory(folder) where your code lives. Lets say you keep your code > in C:\Projects\Python > > start the DOS box > Type (the bits in bold): > > C\:..\> cd C:\Projects\Python > > Now type > > C:\Projects\Python>python myprogram.py > > using whatever your python file is called... > > Now, provided everything is set up properly it should run. > In fact you might even get away wioth jusdt typing: > > C:\Projects\Python\> myprogram.py > > Because in theory Windows should know to run python > for a .py file.... But it often "forgets" :-( > > > Alan Gauld > Author of the Learn To Program website > http://www.alan-g.me.uk/ > > > > > > ________________________________ > From: Dipo Elegbede <delegb...@dudupay.com> > To: ALAN GAULD <alan.ga...@btinternet.com> > Sent: Friday, 21 May, 2010 19:35:57 > Subject: Re: PYTHON 3.1 > > I still can not successfully run Python from the windows command > prompt after doing all you've directed in the tutorials. (Pls note, > I'm not ruling out the probability that I didn't get the instructions > right. As a matter of fact, this is possibly why I still have the > problem.) > Sir, I'm hoping you could take me through that again. > Like when I type > C:document and setting>python xx.py > It tells me the file does not exit. > It atimes starts python when I type python at the prompt to give: > C:....Python> > When i type the name of the file at the python prompt, I still get an > error.e.g > Python>read.py > It comes with error. > It's challenging because some examples in your tutorial require I run > from the prompt and so I'm getting stucked midway. > Please Help. > Regards, > > On 5/21/10, Dipo Elegbede <delegb...@dudupay.com> wrote: >> Hi Alan Sir, >> >> I have been reading through your site and the tutorials, it's just >> something else, I started feeling like a real programmer when i worked >> through the easygui thingy, it was really a mind-blower. >> I hope you'll pardon my pace of learning. I still didn't get some >> aspect under 'Conversing with the user' >> i really read through and I am hoping to reread but I would like you >> shed more light on the stdin and stdout areas. >> They are really confusing. >> Please help. >> Regards, >> >> On 5/20/10, Dipo Elegbede <delegb...@dudupay.com> wrote: >>> Ok, Master. I should would have a lot to learn from you. >>> >>> I hope you'd oblige me that rare priviledge. >>> >>> Regards, Master! >>> >>> On 5/20/10, ALAN GAULD <alan.ga...@btinternet.com> wrote: >>>> >>>> >>>>> I may consider pascal after excelling in Python. >>>> >>>> I wouldn't bother, the only place it is used nowadays is in the >>>> Borland Delphi programming tool for Windows(*). Delphi is very >>>> good if you already know Pascal but otherwise is just another >>>> language to learn! :-) >>>> >>>> (*)Although there is a freeware version of Pascal - fpc - that is >>>> compatible with Delphi if you really want to try it out. But >>>> definitely wait till after Python. (Actually Python is a good >>>> intro to Delphi, they have many features in common) >>>> >>>> Alan G. >>> >>> >>> -- >>> Elegbede Muhammed Oladipupo >>> OCA >>> +2348077682428 >>> +2347042171716 >>> www.dudupay.com >>> Mobile Banking Solutions | Transaction Processing | Enterprise >>> Application Development >>> >> >> >> -- >> Elegbede Muhammed Oladipupo >> OCA >> +2348077682428 >> +2347042171716 >> www.dudupay.com >> Mobile Banking Solutions | Transaction Processing | Enterprise >> Application Development >> > > -- > Sent from my mobile device > > Elegbede Muhammed Oladipupo > OCA > +2348077682428 > +2347042171716 > www.dudupay.com > Mobile Banking Solutions | Transaction Processing | Enterprise > Application Development > -- Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor