NameError: global name 'xrange' is not defined in Python 3

Ads
 

NameError: global name 'xrange' is not defined in Python 3

Hi,

I am running a program in Python 3 and its throwing following error:

NameError: global name 'xrange' is not defined in Python 3

How to solve NameError: global name 'xrange' is not defined in Python 3?

Thanks

View Answers

November 19, 2017 at 8:03 AM

Hi,

I Python 2 xrange() is renamed to range().

So you should use:

range()

function to solve the issue:

NameError: global name 'xrange' is not defined in Python 3

Thanks

Ads









Related Tutorials/Questions & Answers:
NameError: global name 'xrange' is not defined in Python 3
NameError: global name 'xrange' is not defined in Python 3  Hi, I am...: global name 'xrange' is not defined in Python 3 How to solve NameError: global name 'xrange' is not defined in Python 3? Thanks
attributeerror 'dict' object has no attribute 'iteritems' python 3
attributeerror 'dict' object has no attribute 'iteritems' python 3  Hi, Another error in python program: attributeerror 'dict' object has no attribute 'iteritems' python 3 How to solve this? Thanks   Hi, In Python
Advertisements
Name
Name  make a program that take a input from user in alphabet and show all the name of that character E.g User give character "B". The program shows all the human names which starts from B.   Java show all names
ptor is not defined
ptor is not defined  Hi, I am trying to use the protractor for HTML test cases. Due to some reason it is giving error ptor is not defined. How to resolve ptor is not defined error? Thanks   Hi, If you are still
Deep Learning with Python Programming
Deep Learning with Python Programming  Hi, How to learn Deep Learning with Python Programming? Thanks   Deep Learning with Python Python... Leaning, Python stands out as it provides many libraries to develop many deep
ANSI Color Codes with Python
ANSI Color Codes with Python   Use ANSI codes to play with colors and styles. Create a program that will spit out a user inputted string in a color, style, or background color that they can choose. To do this, you'll need
Version of drools>drools-python dependency
List of Version of drools>drools-python dependency
Version of cocoon>cocoon-python dependency
List of Version of cocoon>cocoon-python dependency
How to run external command in Python?
How to run external command in Python?  Hi, I am writing an application in Python and there is requirement of calling the external command from the Python program. I spend some time but could not find good example of calling
3
Spring 3
Spring 3  Hi I want to know how to write code Spring 3 for registration and login pages with help of data bse.Please help me I am new to Spring
PHP User Defined Function
PHP User Defined Function An user-defined function saves  us from ... functions as per the need. General structure of the user defined function is: function function_name([mixed $var,.....]){ PHP code} mixed is the datatype
Problem in Spring 3 MVC and Hibernate 3 Example tutorial source codes
Problem in Spring 3 MVC and Hibernate 3 Example tutorial source codes  I referred your tutorial "Spring 3 MVC and Hibernate 3 Example" and downloaded...: Error creating bean with name 'articleDao': Injection of autowired
user defined date class
user defined date class  Develop a user defined date class with public.Fill the members using existing class method.implement the methods for finding current date(),days between method,advanced days and after days
user defined date class
user defined date class  Develop a user defined date class with public.Fill the members using existing class method.implement the methods for finding current date(),days between method,advanced days and after days
Version of plexus>plexus-python-factory dependency
List of Version of plexus>plexus-python-factory dependency
JavaScript User Defined Functions
JavaScript User-Defined Functions: An user-defined function saves  us... can make your own as per the need. General structure of the user defined function is: function function_name(par1, par2,..){ statement} par1, par2
User Defined Exception In Java
User Defined Exception In Java In terms of programming when we talk about.... Then you will be required to create your own exception. A user defined exception can... for defining a user defined exception your exception class should be the subclass
$_GET[] index is not defined
$_GET[] index is not defined  Hi, What could be solution of the error: $_GET['someparameter'] index is not defined Thanks   Hi, You can use the following code: if (isset($_GET['someparameter'])) { // your code
Maven Dependency cocoon-python >> 2.1.3
You should include the dependency code given in this page to add Maven Dependency of cocoon >> cocoon-python version2.1.3 in your project
Maven Dependency cocoon-python >> 2.1.4
You should include the dependency code given in this page to add Maven Dependency of cocoon >> cocoon-python version2.1.4 in your project
Maven Dependency cocoon-python >> 2.1.5.1
You should include the dependency code given in this page to add Maven Dependency of cocoon >> cocoon-python version2.1.5.1 in your project
Maven Dependency cocoon-python >> 2.1.6
You should include the dependency code given in this page to add Maven Dependency of cocoon >> cocoon-python version2.1.6 in your project
Maven Dependency cocoon-python >> 2.1.7
You should include the dependency code given in this page to add Maven Dependency of cocoon >> cocoon-python version2.1.7 in your project
Maven Dependency cocoon-python >> 2.1.8
You should include the dependency code given in this page to add Maven Dependency of cocoon >> cocoon-python version2.1.8 in your project
Maven Dependency drools-python >> 2.0
You should include the dependency code given in this page to add Maven Dependency of drools >> drools-python version2.0 in your project
Maven Dependency drools-python >> 20040622.175041
You should include the dependency code given in this page to add Maven Dependency of drools >> drools-python version20040622.175041 in your project
Maven Dependency drools-python >> 20040623.065114
You should include the dependency code given in this page to add Maven Dependency of drools >> drools-python version20040623.065114 in your project
Maven Dependency drools-python >> 20040630.215721
You should include the dependency code given in this page to add Maven Dependency of drools >> drools-python version20040630.215721 in your project
Maven Dependency drools-python >> 20040701.153744
You should include the dependency code given in this page to add Maven Dependency of drools >> drools-python version20040701.153744 in your project
Maven Dependency drools-python >> 20040726.171808
You should include the dependency code given in this page to add Maven Dependency of drools >> drools-python version20040726.171808 in your project

Ads