Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint
Cover Image
Cover Image
Drag to reposition
Contributed Answers

How to convert an integer to an ASCII value in Python?

How to convert an integer to an ASCII value in Python?                                            
Answered on 8th Feb, 2018, 0 Views

ASCII character associated to an integer is obtained by chr() function. The argument for this function can be any number between 0 to 0xffff ,

How to convert an integer to a unicode character in Python?

How to convert an integer to a unicode character in Python?                                                     
Answered on 8th Feb, 2018, 0 Views

Python library’s chr() function converts Unicode character associated to any interger which is between 0 an 0x10ffff. ,

How to convert a single character to its integer value in Python?

How to convert a single character to its integer value in Python?                                                           
Answered on 8th Feb, 2018, 0 Views

Each character is associated with an ASCII value which is a unique number. It is obtained by ord() function. ,

How we can create a dictionary from a given tuple in Python?

How we can create a dictionary from a given tuple in Python?                                         
Answered on 8th Feb, 2018, 0 Views

We can use zip() function to produce an iterable from two tuple objects, each corresponding to key and value items and then use dict() function to form dictionary object , Dictionary comprehension syntax can also be used to construct dictionary object from two tuples ,

How do we convert a string to a set in Python?

How do we convert a string to a set in Python?                                                   
Answered on 8th Feb, 2018, 0 Views

Python’s standard library contains built-in function set() which converts an iterable to set. A set object doesn’t contain repeated items. So, if a string contains any character more than once, that character appears only once in the set object. Again, the characters may not appear in the same sequence as in the string as set() function has its own hashing mechanism ,

why Python can't define tuples in a function?

I am unable to define tuple object as one of the parameters of a function. why Python can't define tuples in a function?
Answered on 2nd Jan, 2018, 0 Views

Since Python 3.0, it is no longer possible to define unpacked tuple as a parameter in a function (PEP 3113). It means if you try to define a function as below: , Python interpreter displays syntax error at first bracket of tuple. Instead, define tuple objects as parameter and unpack inside the function. In following code, two tuple objects representing x and y coordinates of two points are .....

How to find what is the index of an element in a list in Python?

Python sequences are indexed collection. : How to find what is the index of an element in a list in Python?
Answered on 2nd Jan, 2018, 0 Views

The index() method available to List (as well as other sequence type such as string and tuple) is useful to find first occurrence of a particular element in it. , To obtain indexes of all occurrences of an element, create enumerate object (which presents iterator for index and value of each element in list) ,

What is syntax of tuple declaration in Python?

What is the syntax of tuple declaration in Python? Would you explain the syntax of tuple with a suitable example?
Answered on 2nd Jan, 2018, 0 Views

A tuple is a comma separated sequence of items. The sequence can be optionally put inside parentheses. , Parentheses are essential if a null tuple or tuple with one element has to be created ,

How I can convert a Python Tuple into Dictionary?

A tuple object internally contains tuples with two items each.  How I can convert a Python Tuple into Dictionary object?
Answered on 2nd Jan, 2018, 0 Views

A dictionary object can be constructed using dict() function. This function takes a tuple of tuples as argument. Each tuple contains key value pair. , If you want to interchange key and value, ,

How do we assign values to variables in a list using a loop in Python?

How do we assign values to variables in a list using a loop in Python? Can a list object be dynamically created by user input?
Answered on 2nd Jan, 2018, 0 Views

Python’s built-in list class has append() method. We can get user input and add it to list till user presses Enter key. An infinite while loop contains input() function and append() method ,

loader
Advertisements
Contribution

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.