Data Type Conversion, Basic Computer Science

Assignment Help:
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.

Related Discussions:- Data Type Conversion

What is a view, Question (a) What is a view? (b) Can we use a view t...

Question (a) What is a view? (b) Can we use a view to insert or update a record into a table? Do we have any limitation to perform the above command? (c) The syntax to cr

Functions, difference between recursion and iteration

difference between recursion and iteration

Analogue to digital converter, Analogue to digital converter: In an ADC...

Analogue to digital converter: In an ADC a range of input values must correspond to a unique digital word.  The type of code used depends on the system but here only binary cod

Graphs, Find the corresponding matrix of the digraph above

Find the corresponding matrix of the digraph above

Probability, Mike sells on the average 15 newspapers per week (Monday – Fri...

Mike sells on the average 15 newspapers per week (Monday – Friday). Find the probability that 2.1 In a given week he will sell all the newspapers [7] 2.2 In a given day he will sel

Advantages and Disadvantages of Threads over Multi processes, Advantages:- ...

Advantages:- • Sharing Treads permit the sharing of a lot resources that cannot be shared in process, for instance, sharing code section, data section, Operating System resource

Concept of instruction, Concept of instruction: The CPU is a semicondu...

Concept of instruction: The CPU is a semiconductor integrated  circuit chip consisting of a large number of transistors. In personal computers, the CPU is also referred by the

Why is the atm selected as a transport network in 3g, Why is the ATM select...

Why is the ATM selected as a transport network in 3G? Answer: ATM provides efficient support for transmission of voice, data, and video ATM provides QoS guarantee and reliability

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd