- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- 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 27104 Articles for Server Side Programming
460 Views
Double quotes are used to represent a string or a character as well as can be used in the print function to print the defined statement as the output. The functionality of the single quotes and double quotes is same. We can use any type quotes as per our requirement. The following is the syntax to create a string using the double quotes in the python programming language. str = “text” Where, “ ” are the double quotations text is the data to be in string format Example Let’s see an example to understand the functionality and ... Read More
782 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. It’s 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 import the json package. In this package we have a method named dumps() which is used to convert the python tuple objects into the Java ... Read More
24K+ 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
5K+ Views
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 which we can use in the python programming language. Single quotes Double quotes Triple quotes What are Single quotes? Single quotes (' ') are used to create strings and characters in Python programming. Since the print() function accepts string values we can directly pass values to it wrapping them within the single quotes. Example In this example, we will create a string using the single quotes and assign it to the ... Read More
7K+ 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, 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 tuple.Indexing is the concept used for accessing the elements from particular data structures. There are two ways of performing ... Read More
3K+ 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
22K+ Views
If L1 and L2 are list objects containing keys and respective values, following methods can be used to construct dictionary object. Zip two lists and convert to dictionary using dict() function >>> L1 = ['a','b','c','d'] >>> L2 = [1,2,3,4] >>> d = dict(zip(L1,L2)) >>> d {'a': 1, 'b': 2, 'c': 3, 'd': 4} Using dictionary comprehension syntax >>> L1 = ['a','b','c','d'] >>> L2 = [1,2,3,4] >>> d = {k:v for k,v in zip(L1,L2)} >>> d {'a': 1, 'b': 2, 'c': 3, 'd': 4}
311 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}
131 Views
Dictionary object is an unordered collection of key-value pairs, separated by comma and enclosed in curly brackets. Association of value with key is marked by : symbol between them.>>> D1={'a':1,'b':2,'c':3}Key can appear in a dictionary object only once, whereas single value can be assigned to multiple keys. Key should be of immutable data type i.e. number, string or tuple.>>> D2={1:'aaa', 2:'bbb', 3:'ccc'} >>> D3={(10,10):'x1', (20,20):'x2'} >>> D4={'Microsoft':['MS Office', 'Windows', 'C#'], 'Oracle':['Oracle', 'Java', 'MySQL']}