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
Packet Switching: This is one of recent techniques of switching. Packet switching was originally developed for use by ARPA network by the Defence Department of US. According t

Communication Networks: Communication networks are made up of transmission lines, concentrators, switching mechanisms and non-data processing components. Due to increased comp

A process is a chronological program in execution. The constituents of a process are the following: • The object program to be executed ( described the program text in UNIX) • Th

In computing, a system call is how a program asks for a service from an operating system''s kernel. This may contain hardware related services (for example accessing the hard disk)

You are an engineer involved in the development of a financial system. During installation, you discover that this system will make a significant number of people redundant. The pe

types of computer on the basis of shape, size & resources

Problem 1. Briefly explain on the characteristics of computers Explanation of characteristics of computers 2. Write a note on Cache Memory Note on Cache Memor

QUESTION (a) Outline the five main steps in the Web Design Process (b) Draw an annotated diagram explaining how data is transmitted to web servers during a standard form sub

i need help with flowcharting a procedure

solution of two degree of freedom system with matlab program???