zeros() python function is undefined

Need help with C, C++, perl, python, etc?

zeros() python function is undefined

Postby F37U5G0D » 2009-04-28 22:48

When I run my code zeros ([7,7], int) I get the error that the zeros() is undefined even though I have the numpy package installed. What gives?
F37U5G0D
 
Posts: 102
Joined: 2008-07-27 01:30
Location: Monmouth, Il

Re: zeros() python function is undefined

Postby BioTube » 2009-04-28 22:56

Did you remember to import the proper package/library/whatever?
Image
Ludwig von Mises wrote:The elite should be supreme by virtue of persuasion, not by the assistance of firing squads.
User avatar
BioTube
 
Posts: 7551
Joined: 2007-06-01 04:34

Re: zeros() python function is undefined

Postby F37U5G0D » 2009-04-28 23:53

Yeah my code starts with
Code: Select all
import string, sys, random, array, Numeric, numpy

I don't get any errors on that line yet zeros(anything) throws an error everytime.
F37U5G0D
 
Posts: 102
Joined: 2008-07-27 01:30
Location: Monmouth, Il

Re: zeros() python function is undefined

Postby lacy1809 » 2019-03-09 01:03

Hello All,

I am newbie to python. And i'm practicing at home to see the youtube videos.
I was trying to use a=zeros(5) in python, but getting the error. Please check it and help me to solve

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'zeros' is not defined

Please help me with this or suggest me any of the python tutorial where i can learn the deep concept of python.

Thanks in advance!
lacy1809
 
Posts: 1
Joined: 2019-03-09 00:52

Re: zeros() python function is undefined

Postby GarryRicketson » 2019-03-09 02:09

Please check it and help me to solve

You can try to check it like this:
Python function undefined NameError: name 'zeros' is not defined
The first hit, is almost identical to what you posted, maybe it was you or you copied / pasted the same to here ???
https://bytes.com/topic/python/answers/786519-nameerror-name-zeros-not-defined
Says you need to use "numpy",
Please help me with this or suggest me any of the python tutorial where i can learn the deep concept of python

In the same results, there is this.

https://docs.python.org/3.3/tutorial/introduction.html
Please make some effort to learn how to help your self, I will give you 1 more example, to help you get started.
python tutorial where i can learn the deep concept of python
You should see there are many results, there are many good tutorials, if for some reason you can not do searches on your own, or don't get any good results, maybe I will post some of the links here,..also, do you realize this thread is 10 years old ? No matter, now it will be more up to date.
The first hit, looks pretty good: https://docs.python-guide.org/intro/learning/
If you don't like that one, try some of the others, and please, in the future try to make a little effort to search for answers, and tutorials, learn how to help your self.
Maybe read this:
"What we expect you have already Done"
User avatar
GarryRicketson
 
Posts: 5877
Joined: 2015-01-20 22:16
Location: Durango, Mexico


Return to Programming

Who is online

Users browsing this forum: No registered users and 4 guests

fashionable