GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Programming  >  Python
Go To First  |  Previous Question  |  Next Question 
 Python  |  Question 15 of 23    Print  
What is the built-in function used in Python to iterate over a sequence of numbers?

  
Total Answers and Comments: 2 Last Update: December 05, 2007     Asked by: fred 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
September 28, 2007 15:59:58   #1  
stranger1 Member Since: September 2007   Contribution: 4    

RE: What is the built-in function used in Python to it...
Enumerate.... correct me if i am wrong....
 
Is this answer useful? Yes | No
November 13, 2007 18:39:14   #2  
Nagappan Member Since: November 2007   Contribution: 2    

RE: What is the built-in function used in Python to it...
range is the built-in function to be used for interating the sequence of numbers.

for iter in range (0 10):
print iter # prints 0 to 9


for iter in range (0 10 2): # The last argument is the sequence to use. Default is 1.
print iter # prints 0 2 4 6 8


 
Is this answer useful? Yes | No

 Related Questions

What is used to represent Strings in Python.Is double quotes used for String representation or single quotes used for String representation in Python?

Latest Answer : Python programming language was created by Guido van Rossum. ...
Read Answers (1) | Asked by : timmy

Latest Answer : A lambda statement is used to create new function objects and then return them at runtime thats why  lambda forms in Python didn't contain statement. ...
Read Answers (1) | Asked by : janelyn

Latest Answer : Memory is managed through private heaps. Private heap is managed by python memory manager. ...
Read Answers (1) | Asked by : sripri

Latest Answer : C++ is the appropriate language that Python resemble in its class syntax. ...
Read Answers (1) | Asked by : scott

Latest Answer : At the same time he began implementing Python, Guido van Rossum was also reading the published scripts from "Monty Python's Flying Circus" (a BBC comedy series from the seventies, in the unlikely case you didn't know). It occurred to ...

Does Python support strongly for regular expressions? What are the other languages that support strongly for regular expressions?
Read Answers (1) | Asked by : christia

Latest Answer : Objects referenced from the global namespaces of Python modules are not always deallocated when Python exits. This may happen if there are circular references. There are also certain bits of memory that are allocated by the C library that are impossible ...
Read Answers (1) | Asked by : Robert

Latest Answer : One of the disadvantage of the Python programming language is it is not suited for fast and memory intensive tasks. ...
Read Answers (1) | Asked by : Robert

Latest Answer : Most of the object oriented programming languages to name a few are C++, CLISP and Java is the language from which Python has got its features or derived its features. ...


 Sponsored Links

 
Related Articles

Concepts of Object-Oriented Programming

Object Oriented JavaScript In this chapter you ll learn about OOP Object Oriented Programming and how it relates to JavaScript As an ASP NET developer you probably have some experience working with objects and you may even be familiar with concepts such as inheritance However unless you re already a
 

C++ Pure Virtual Function and Base Class

C Pure Virtual Function and Virtual Base Class In this C tutorial you will learn about pure virtual function declaration of pure virtual function and virtual base class virtual base class and how to implement a virtual base class explained with examples mosgoogle center What is Pure Virtual Function
 

C++ Function Passing Types

C Function Passing Types In this C tutorial you will learn about function passing types two types of arguments passing in functions passed by value  and  passed by reference are discussed here mosgoogle center The arguments passed to a function can be performed in two ways Passed
 

Working with XML in Python

Working with XML in Python The Extensive Markup Language and Python are two very different platforms Python is a programming language and XML is a standards oriented language document Python is a full fledged programming language which has its roots deep in scripts and also has matured over a period
 

What is DECODE function used for?

DECODE is used to decode a CHAR or VARCHAR2 or NUMBER into any of several different character strings or numbers based on value. That is DECODE does a value-by-value substitution. For every value that is given in the DECODE function it makes an if then check and matches the value. The general format
 

printf() Function Return Value

What is the return value from printf() function? printf function always returns the number of characters printed. Let us understand this with an example: main() { int a=10; printf("%d",printf("%d %d %d", a,a,a)); } In this above program the inner printf i
 

How is the main() function declared?

The declaration of main can be done as int main() One more declaration that can be taken by main is command line arguments form int main(int argc, char *argv[]) or this can also be written as int main(argc, argv) int argc; char *argv[]; NOTE: It is not possible for one to declare the main
 

How does the function call within function get evaluated?

Whenever we have more than one function which is called for a finite number of times then such a function gets evaluated from inside out. Let us understand this concept with an example. For instance consider a function sample called within it 4 times as given in program below: main() { int a=50;
 

What happens when a variable is not initialized in main function?

When a variable is not initialized in main function it contains garbage value. This can be well seen from the example below main() { int x; printf(“%d”,x); z= sample() } sample() { printf(“Testing program”); } Output is   &n
 

What is the default return value of a function?

The default return value from a function is int. In other words, unless explicitly specified the default return value by compiler would be integer value from function.   When a programmer wants other than integer values to be returned from function then it is essential that the pro
 

About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape