Mohd Mohtashim has Published 238 Articles

Loop Control Statements in Python

Mohd Mohtashim

Mohd Mohtashim

Updated on 24-Jan-2020 12:04:27

840 Views

Loop control statements change execution from its normal sequence. When execution leaves a scope, all automatic objects that were created in that scope are destroyed.Python supports the following control statements. Click the following links to check their detail.Let us go through the loop control statements brieflySr.NoOperator & Description1break statementTerminates the ... Read More

Python Membership Operators

Mohd Mohtashim

Mohd Mohtashim

Updated on 24-Jan-2020 12:00:24

191 Views

Python’s membership operators test for membership in a sequence, such as strings, lists, or tuples. There are two membership operators as explained below −Sr.NoOperator & DescriptionExample1inEvaluates to true if it finds a variable in the specified sequence and false otherwise.x in y, here in results in a 1 if x ... Read More

Data Type Conversion in Python

Mohd Mohtashim

Mohd Mohtashim

Updated on 24-Jan-2020 11:41:39

9K+ Views

Sometimes, you may need to perform conversions between the built-in types. To convert between types, you simply use the type name as a function.There are several built-in functions to perform conversion from one data type to another. These functions return a new object representing the converted value.Sr.No.Function & Description1int(x [, ... Read More

Dictionary Data Type in Python

Mohd Mohtashim

Mohd Mohtashim

Updated on 24-Jan-2020 11:32:11

14K+ Views

Python's dictionaries are kind of hash table type. They work like associative arrays or hashes found in Perl and consist of key-value pairs. A dictionary key can be almost any Python type, but are usually numbers or strings. Values, on the other hand, can be any arbitrary Python object.ExampleDictionaries are ... Read More

Tuple Data Type in Python

Mohd Mohtashim

Mohd Mohtashim

Updated on 24-Jan-2020 11:31:28

946 Views

A tuple is another sequence data type that is similar to the list. A tuple consists of a number of values separated by commas. Unlike lists, however, tuples are enclosed within parentheses.ExampleThe main differences between lists and tuples are: Lists are enclosed in brackets ( [ ] ) and their ... Read More

List Data Type in Python

Mohd Mohtashim

Mohd Mohtashim

Updated on 24-Jan-2020 11:30:34

4K+ Views

Lists are the most versatile of Python's compound data types. A list contains items separated by commas and enclosed within square brackets ([]). To some extent, lists are similar to arrays in C. One difference between them is that all the items belonging to a list can be of different ... Read More

Multiple Statements in Python

Mohd Mohtashim

Mohd Mohtashim

Updated on 24-Jan-2020 11:30:19

5K+ Views

Multiple Statements on a Single LineThe semicolon ( ; ) allows multiple statements on the single line given that neither statement starts a new code block. Here is a sample snip using the semicolon −import sys; x = 'foo'; sys.stdout.write(x + '')Multiple Statement Groups as SuitesA group of individual statements, ... Read More

String Data Type in Python

Mohd Mohtashim

Mohd Mohtashim

Updated on 24-Jan-2020 11:29:57

3K+ Views

Strings in Python are identified as a contiguous set of characters represented in the quotation marks. Python allows for either pairs of single or double quotes. Subsets of strings can be taken using the slice operator ([ ] and [:] ) with indexes starting at 0 in the beginning of ... Read More

Number Data Type in Python

Mohd Mohtashim

Mohd Mohtashim

Updated on 24-Jan-2020 11:29:29

512 Views

Number data types store numeric values. Number objects are created when you assign a value to them. For example −var1 = 1var2 = 10You can also delete the reference to a number object by using the del statement. The syntax of the del statement is −del var1[, var2[, var3[...., varN]]]]You ... Read More

Multiple Assignments to Single Value in Python

Mohd Mohtashim

Mohd Mohtashim

Updated on 24-Jan-2020 11:25:29

612 Views

Python allows you to assign a single value to several variables simultaneously. For example −a = b = c = 1Here, an integer object is created with the value 1, and all three variables are assigned to the same memory location. You can also assign multiple objects to multiple variables. ... Read More

Previous 1 ... 7 8 9 10 11 ... 24 Next
Advertisements