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
QUESTION Your Library is currently offering access to the Internet for its subscribers on a fee paying basis. Subscribers should make a booking for each slot of one hour in adv

draw the logic diagram of 2*4 decoder in only NOR gate .include enable inputs .

File Organization There are three types of file organization used in practice. Let us consider the example of a dictionary. The dictionary contains listing of English wo

Question 1 What do you mean by semantic networks? Explain inheritance in semantic networks Question 2 Explain Partitioned semantic networks with an example Question

assignment of making a small database in C# with a back end support of MS Access. i required a form with following options : Enter a new user (user name, father name, age, d

Qestion 1 What is .Net Framework? Qestion 2 Write short notes on constructors and destructors Qestion 3 Explain boxing and unboxing with examples Qestion 4 What is

classify computer system according to capacity. how they are different from computer according to the classification of technology.provide the comparative study also.

QUESTION (a) Distinguish between S-HTTP and SSL (b) What are the three basic security provided by SSL? (c) Discuss the limitations of SSL (d) State the port number us

A hash sign (#) that is not within a string literal begins a comment. All characters later than the # and up to the physical line end are division of the comment, and the Python in

Resource sharing is a concept which has developed to contain many cooperative activities among libraries and other stakeholders. Interlibrary loan continues to be the basis of reso