for Ex.

x = 10
print x
print type (x)

it should show you that x ia 10 and its interger "<type 'int'>".

but how can i prove for example that the result of sqrt(n) is an integer?

The function sqrt(x) returns a float:

import math

x = 9
y = math.sqrt(x)

print y, type(y)  # 3.0 <type 'float'>

If you want the result to be an integer use int(y).

You can also use isinstance() method to check whether an object is an instance or type of a class[everything in Python is an object]

>>> v=9
>>> if isinstance(v, int):
	print 'int'

int

but how can i prove for example that the result of sqrt(n) is an integer?

You can do this (maybe is there more elegant way)

if math.sqrt(n) == float(int(math.sqrt(n))):
    print "sqrt(n) is an integer"
Comments
nice work

does anybody knows why this function doesn´t work very well:

f=lambda n: reduce(lambda x,y:x**2+y**2, map(int,str(n)))

I want that this function add the square of the digits of a number

an example of what i want:

f(442)=4**2+4**2+2**2=36

Create a new thread for this question. People with questions like yours will often search on the post name, and it's helpful to have it separate from the lead question.

Jeff

can some one suggest me below
If i need to fire http request multiple times in python.Please suggest me steps as i am new to python

This question has already been answered. Start a new discussion instead.