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 1 Describe the following with respect to creating Web Forms in .Net environment- Web Form Life Cycle Creating a Web Form Write programs with corresponding

Question 1 List two I/O virtualization methods. Based on different features compare these two methods Question 2 Discuss three areas considered by organizations to secure the

Find shortest path from node 1 to node 10 in the network shown in figure, also find shortest path from node 3 to node 10. Please write all steps to finding shortest path mechanism

mention the aims of education in present scenario

requirement analysis and specification for online voting

what is member dereferencing oprator ?

Question Write the steps for applying animations. Prepare a presentation of 5 slides in a creative for any topic in your semester (research methods/Business strategy/Financial

Compact Diskette (CD) CD-ROM CD-ROM stands for Compact Disk-Read Only Memory. This disk comes with data already stored in it. It can store around 640 MB of

Cathode Ray Tube Monitors (CRT): Monitors display what is going on in your computer. They can run at various resolutions. It is the part of computer which looks like a TV set.

Collaboration: Collaboration is defined as an act or process of working together on a project or some intellectual activity. But what is the importance of collaboration? The w