help
download wxpython but whenever I try to use it I get this I’m a beginner in python pls I need help. Traceback (most recent call last): File "C:/Python27/wxp.py", line 1, in import wx File "C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx\__init__.py", line 45, in from wx._core import * File "C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 4, in import _core_ ImportError: DLL load failed: %1 is not a valid Win32 application.-- http://mail.python.org/mailman/listinfo/python-list
new to python and programming at large
pls I want to write a function that can compute for the sqrt root of any number.bt it not working pls help. from math import sqrt def squareroot(self): x = sqrt(y) print x-- http://mail.python.org/mailman/listinfo/python-list
new to python and programming at large
pls I want to write a function that can compute for the sqrt root of any number.bt it not working pls help. from math import sqrt def squareroot(self): x = sqrt(y) print x-- http://mail.python.org/mailman/listinfo/python-list
new to python and programming at large.
thanks for ur help I wz able to do it.but I wish to expand it by asking a user to input a number for the sqrt to be calculated it I dd it this way but its not working. from math import sqrt number = raw_input('enter a number:') def number(y): return number(Y) thnx-- http://mail.python.org/mailman/listinfo/python-list
Re: new to python and programming at large.
-Original Message- From: Dave Angel Sent: Wednesday, January 09, 2013 12:00 PM To: python-list@python.org Subject: Re: new to python and programming at large. On 01/09/2013 05:28 PM, kwakukwat...@gmail.com wrote: thanks for ur help I wz able to do it.but I wish to expand it by asking a user to input a number for the sqrt to be calculated it I dd it this way but its not working. from math import sqrt number = raw_input('enter a number:') def number(y): return number(Y) Please don't keep posting new messages on the same topic. When adding to a thread, use Reply (and make sure python-list is in the to: or cc: field). This program has a pile of problems with it. You've used the name 'number' for three different purposes. Let me explain what those lines do. number = raw_input(... Capture a string from the user. Type is str. def number(y): toss out the string the user entered, and bind that name instead to a function definition that takes a parameter y. return number(Y) Attempt to call your own function recursively, but first crash since Y is undefined. Y is not the same as y. Fortunately, you never actually call the function, by any name. You never used the string you got from the user, but if you had fixed everything else, you'd have discovered that sqrt() expects either an int or a float. Suggestions: put your imports first then put your function definitions and classes only then put your initialization and calls to those functions and classes. Make sure you don't use the same name for two different purposes. It can frequently be okay, but it's certainly confusing for a beginner. Watch the case of any names you use. It matters. You don't have a spec, but perhaps this is close to what you want (untested): from math import sqrt def squareroot(y): return sqrt(y) number = float(raw_input('enter a number:')) print squareroot(number) -- DaveA thanks so much it worked.I have tried and tried.look at what I was doing. me = raw_input("Enter a value:") from math import sqrt def squareroot(y): me = squareroot(y) return squareroot(y) thanks I am very greatful. -- http://mail.python.org/mailman/listinfo/python-list
please i need explanation
def factorial(n): if n<2: return 1 f = 1 while n>= 2: f *= n f -= 1 return f -- http://mail.python.org/mailman/listinfo/python-list
Re: please i need explanation
-Original Message- From: K. Elo Sent: Friday, January 11, 2013 3:56 AM To: python-list@python.org Subject: Re: please i need explanation Hi! Since there is no stated question, I need to guess: n -= 1 (instead of "f -= 1") should work. Or maybe the question was a totally different one... -Kimmo 11.01.2013 17:35, kwakukwat...@gmail.com wrote: def factorial(n): if n<2: return 1 f = 1 while n>= 2: f *= n f -= 1 return f please it works.but don’t get why the return 1 and the code below. -- http://mail.python.org/mailman/listinfo/python-list
help
pls this is a code to show the pay of two people.bt I want each of to be able to get a different money when they enter their user name,and to use it for about six people. database = [ ['Mac'], ['Sam'], ] pay1 = 1000 pay2 = 2000 name = raw_input('Enter your name: ') if [name] in database:print "your pay is $",pay-- http://mail.python.org/mailman/listinfo/python-list
need explanation
please I need some explanation on sys.stdin and sys.stdout, and piping out-- http://mail.python.org/mailman/listinfo/python-list
why not?
f = open(r'c:\text\somefile.txt') for i in range(3): print str(i) + ': ' + f.readline(), please with the print str(i) + ‘: ‘ + f.readline(), why not print str(i) + f.readline(),-- http://mail.python.org/mailman/listinfo/python-list