
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 10476 Articles for Python

5K+ Views
In Python, 'not in' membership operator evaluates to true if it does not finds a variable in the specified sequence and false otherwise. For example >>> a = 10 >>> b = 4 >>> l1 = [1,2,3,4,5] >>> a not in l1 True >>> b not in l1 False Since 'a' doesn't belong to l1, a not in b returns True. However, b can be found in l1, hence b not in l1 returns False

307 Views
The Python ternary operator returns a value based on whether a condition is True or False. It is similar to an if-else statement but is expressed in a single line. For understanding the ternary operator, we need to have an idea about conditional statements. Let's have a basic understanding of the if-else statement. We will have an if block followed by an else block here. The if block is executed when the given condition is True, and the else block is executed if the given condition is False. The following is the basic syntax of the if-else statement - if condition: ... Read More

384 Views
The keys() method of Python dictionary class returns a view object consisting of keys used in the dictionary.>>> d1 = {'name': 'Ravi', 'age': 21, 'marks': 60, 'course': 'Computer Engg'} >>>d1.keys() dict_keys(['name', 'age', 'marks', 'course'])It can be stored as a list object. If new key-value pair is added, the view object is automatically updated.>>> l1=d1.keys() >>> l1 dict_keys(['name', 'age', 'marks', 'course']) >>>d1.update({"college":"IITB"}) >>> l1 dict_keys(['name', 'age', 'marks', 'course', 'college'])

504 Views
The update method is one of the methods of the dictionary data structure. It is used to update the values in the already created dictionary, which means it adds a new key-value pair to the dictionary. The updated key and value will be updated at the last. Python update() Method in Dictionary The dictionary is represented by curly braces{}. The dictionary contains key and value pairs, collectively called items, which can accept any data type of elements as values. It is mutable, which means once the dictionary is created, we can apply the changes. It has key-value pairs separated by ... Read More

1K+ Views
Multidimensional Dictionaries in python Multidimensional dictionaries are part of the dictionaries in Python, which are used to store data. Created by assigning a dictionary to a key within another dictionary, these structures are represented by curly braces {} and can accommodate any data type. Their mutable nature allows modifications after creation. They are composed of unique key-value pairs, separated by a colon (:). While keys are unique, values can be duplicated. Accessing values requires using keys, as dictionaries do not support indexing. To retrieve specific key values, use the key combined with indexing. Syntax The following is the syntax for ... Read More

212 Views
The XML is the markup language used to transfer the data. The XML syntax is the same as the HTML, whereas the tags are predefined in HTML and not in XML. This offers us to store the data between the opening and closing tags. In Python, dictionaries store data as key-value pairs. We can serialize a dictionary to XML format using two popular libraries: dict2xml (widely used) dicttoxml ... Read More

634 Views
Double Quotes in PythonDouble quotes are used to represent a string or a character. The functionality of the single quotes and double quotes is the same. We can use any type of quote as per our requirement. The following is the syntax to create a string using double quotes in the Python programming language. str = “text” Example Let’s see an example to understand the functionality and usage of the double quotes in Python. Initially, we have created a string by passing the sentence in double quotes and assigned it to the variable str. Next we printed ... Read More

1K+ Views
JSON can be abbreviated as JavaScript Object Notation. It means a script of a text file in a programming language to transfer and store the data. It is supported by the Python programming language using a built-in package named JSON. Its text is given in the quoted string format, which contains a key and value within the curly braces{}, which looks like a dictionary. To access a JSON document using Python, we have to use the JSON package. In this package, we have a method named dumps(), which is used to convert the Python tuple objects into the Java objects. ... Read More

30K+ 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