
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 10417 Articles for Python

29K+ Views
In python there are different types of data structures. Among them list, tuple, dictionary. All these three are used to store the data in the python programming language. What is a List? List is one of the data structures available in python which is used to store multiple values in a single data structure. We can create a list in Python using the square braces[ ]. It is mutable which means that we can modify a list once it is created. It takes multiple elements of different data types such as int, float, str etc which are separated by ... Read More

7K+ Views
In Python, strings can be defined using single quotes ('), double quotes ("), or triple quotes (''' or """). For example, 'Hello' is a valid string. There are different types of quotes in Python. Each quotation is used in different scenarios as per the requirement. The following are the different types of quotations that we can use in the Python programming language. Single quotes Double quotes ... Read More

8K+ Views
Tuple is one of the data structures of the Python programming language. It is used to store multiple values separated by commas in an ordered manner. It is immutable in the sense that once the tuple is created cannot perform any operations like deleting, appending, etc. The elements in the tuple can be int, float, string, or binary data types, and it allows duplicates of the elements. It uses indexing for accessing the elements. It allows a single element to be in a tuple. There are different ways to create the empty tuple. Let’s see each way in detail. ... Read More

4K+ Views
The dictionary is the data structure available in python. Dictionaries are also known as associative memories or associative arrays. It is represented by curly braces {}. It stores the data in the form of key and value pairs. Data from a dictionary can be accessed by its key, unlike other data structures which use indexes. To retrieve the value associated with a particular key, one must use index values. As keys in dictionaries are unique, any immutable object such as tuples or strings can be used to identify them. However, values stored in dictionaries do not need to be ... Read More

627 Views
In Python, list is one of the built-in data types. A Python list is a sequence of items separated by commas, enclosed in square brackets [ ]. The items in a Python list need not be of the same data type. In this article, we will discuss different ways to create an empty list in Python. Using Square Brackets This is one of the simplest way to create an empty list to using square brackets[]. An empty list means the list has no elements at the time of creation, but we can add items to it later when needed. my_list=[] ... Read More

24K+ Views
In Python, the dictionary is one of the built-in data types that stores the data in the form of key-value pairs. The pair of key-value is separated by a comma and enclosed within curly braces {}. The key and value within each pair are separated by a colon (:). Each key in a dictionary is unique and maps to a value. It is an unordered, mutable data. Creating dictionary from lists In Python, we can create a dictionary by using two separate lists. One list is considered as the keys, and the second one is considered as values. We ... Read More

406 Views
If L1 and L2 are list objects containing keys and respective values, following list comprehension syntax can be used to construct dictionary object. >>> L1 = ['a','b','c','d'] >>> L2 = [1,2,3,4] >>> d = {L1[k]:L2[k] for k in range(len(L1))} >>> d {'a': 1, 'b': 2, 'c': 3, 'd': 4}

2K+ Views
Converting Integer to ASCII Using chr() Function In Python, the chr() function converts an integer value to the corresponding ASCII (American Standard Code for Information Interchange) character only if the integer range lies between 0 and 127. The chr() function accepts Unicode values within the range of 0 to 1114111. If a value outside this range is provided, the function raises a ValueError. Example In the following example, we have converted integer values to ASCII values using chr() - print(chr(85)) print(chr(100)) print(chr(97)) Following is the output of the above code - U 100 a Example We can ... Read More

4K+ Views
Unicode is a standardized character encoding that assigns a unique number to each character in most of the world's writing systems. Unicode separates the code points from the details of the encoding system. This permits a much wider range of characters up to four bytes. The Unicode character set incorporates the entirety of the ASCII character set as the first 127 characters. All ASCII characters have the same code points in both encodings. Techniques to Convert an Integer to a Character Following are the various techniques to convert an integer to a character in Python − ... Read More

765 Views
In Python, the ord() function converts a given character to the corresponding ASCII (American Standard Code for Information Interchange) integer. The ord() function raises a TypeError if you pass a string value as a parameter. Converting a single alphabet to its integer In the following example, we have converted a character 'A' into its Unicode using the ord() function - my_str='A' result=ord(my_str) print("Unicode of 'A'-", result) Following is an output of the above code - Unicode of 'A'- 65 Printing Integer values of all the alphabets We can use the ord() function to print all the Unicode characters ... Read More