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

Choice of medium - transmission channels, Choice of Medium: All the tr...

Choice of Medium: All the transmission channels discussed in the foregoing paragraphs can be used as point to point connections or as broadcast systems. Transmitting informati

Cathode ray tube monitors, Cathode Ray Tube Monitors (CRT): Monitors d...

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.

Graphical user interface and arrays, In this program, you are going to writ...

In this program, you are going to write a program for playing the game of Hangman. In this game, the computer will pick a word and display a sequence of blanks to be filled in; one

Operating system, advantage and disadvantage of operating system

advantage and disadvantage of operating system

What is an abstract data type, QUESTION (a) What is an abstract data ty...

QUESTION (a) What is an abstract data type? (b) Give two limitations of the array implementation of lists. (c) Give the major disadvantage of the dynamic implementation o

Variable - concept of programming language, Variable - Concept of programmi...

Variable - Concept of programming language: Variable: As referencing memory by its physical address is very tedious, variable names are used. A variable is a symbolic name giv

Types of policy, want to get detail understanding of the types of security ...

want to get detail understanding of the types of security policies including enterprise security policy, issues specific policies etc

Visual basics, Assume that s is a string variable  that is supposed to con...

Assume that s is a string variable  that is supposed to contain a value to be converted to integer. Write a fragment of code that converts the value to integer variable  and displ

HACKER, Briefly explain who a hacker is and what the activities of a hacker...

Briefly explain who a hacker is and what the activities of a hacker are?k question #Minimum 100 words accepted#

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