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
Internal Structure of Agents We have looked at agents in conditions of their outside influences and behaviors: they take effort from the atmosphere and do lucid actions to chan

• It is also known as Shortest-Process-Next (SPN). • Shortest-Job-First (SJF) is a non-preemptive order in which waiting job (or process) with the smallest predictable run-time-to-

They are utilized to move the contents of the operators. Each instruction can be used with many different modes of addressing. MOV MOVS (MOVSB) (MOVSW) MOV INSTRUCTION Principle: D

Here are the more specific requirements and the related points - use the below as a check-off list when you make your presentation.  Please note . . . many of the requirements are

IDA* Search-Artificial intelligence: A* search is a sophisticated and successful search strategy. yet, a problem with A* search is that it might  keep every states in its memor

Time Sharing System: With the use multiprogramming, the batch processing can be quite  efficient. However, for many jobs, it is desirable to provide a mode in which the user i

Hill Climbing - artificial intelligence: As we've seen, in some particular problems, searching the search path from primly to goal state is the point of the exercise. In anothe

How branching takes place in Instruction pipeline. Explain with suitable examples.

Question 1 Discuss the usage and benefits of storyboarding Question 2 Explain the different stages of scriptwriting Question 3 Explain the 12 fundamental principle

Language of Digital Computers: Digital computers are electronic devices which operate on two valued logic (On and OFF). The ability of a transistor to act as a switch is the k