Data Type Conversion, Basic Computer Science

Sometimes you may drop to perform conversions among the built-in types. To translate between types you just use the type name as a function.
There are quite a few built-in functions to carry out conversion from one data type to another. These functions return a new object representing the changed value.
Function Description
Converts x to an integer. Base states the base if x is a string.
long(x [,base] ) Converts x to a long integer. Base identifies the base if x is a string.
float(x) Changes x to a floating-point number.
complex(real [,imag]) Generates a complex number.
str(x) Changes object x to a string representation.
repr(x) Changes object x to an expression string.
eval(str) Estimates a string and returns an object.
tuple(s) Changes s to a tuple.
list(s) Changes to a list.
set(s) Translates s to a set.
dict(d) Generates a dictionary. d must be a sequence of (key, value) tuples.
frozenset(s) Translates s to a frozen set.
chr(x) Translates an integer to a character.
unichr(x) Translates an integer to a Unicode character.
ord(x) Translates a single character to its integer value.
hex(x) Translates an integer to a hexadecimal string.
oct(x) Translates an integer to an octal string.
Posted Date: 5/5/2012 3:59:55 AM | Location : United States







Related Discussions:- Data Type Conversion, Assignment Help, Ask Question on Data Type Conversion, Get Answer, Expert's Help, Data Type Conversion Discussions

Write discussion on Data Type Conversion
Your posts are moderated
Related Questions
#questionWrite a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two poi

Question 1 Explain the importance of graphics in multimedia. What are few of the tips to keep in mind while using graphics for the web? Question 2 Write a long note on co

explain ipx for lan and spx

Basic computer structure: A computer is an electronic device, which can accept and process data by carrying out a set of stored instructions in sequence. This sequence of math

Editor and Assembler:   To write a program in any of the programming languages requires an editor.  This is  a program that is used to create text files. While saving the p

QUESTION (a) Give the two conditions required by a binary tree of depth d to be an almost complete binary tree. (b) Determine what the following recursive C function compute

Number data types store numeric values. They are an immutable data type, which means that changing the value of a number data type results in a newly allocated object. Number objec

solve three given number in ascending order through algorithm

is there any oppurtunity for a mca to teach mcasubjects online