Table of contents | |
Python Basics | |
Conditional Statements | |
Iteration constructs | |
Idea of debugging | |
Lists, Tuples and Dictionary | |
Sorting Algorithm | |
Strings in Python |
Class names start with an uppercase letter and all other identifiers with a lowercase letter.
Starting an identifier with a single leading underscore indicates by convention that the identifier is meant to be private.
Starting an identifier with two leading underscores indicates a strongly private identifier.
If the identifier also ends with two trailing underscores, the identifier is a language-defined special name.
Reserved Words(Keywords): The following list shows the reserved words in Python
These reserved words may not be used as constant or variable or any other identifier names. All the Python keywords contain lowercase letters only.
Literal/ Values: Literals (Often referred to as constant value) are data items that have a fixed value. Python allows several kind of literals. String literals, Numeric literals, Boolean literals, special literal None, literal Collections.
Data Types: Data type is a set of values and the allowable operations on those values. Python has a great set of useful data types. Python’s data types are built in the core of the language. They are easy to use and straight forward.
Numbers can be either integers or floating point numbers.
A sequence is an ordered collection of items, indexed by integers starting from 0. Sequences can be grouped into strings, tuples and lists.
Strings are lines of text that can contain any character. They can be declared with single or double quotes.
Lists are used to group other data. They are similar to arrays.
A tuple consists of a number of values separated by commas.
A set is an unordered collection with no duplicate items.
A dictionary is an unordered set of key value pairs where the keys are unique.
Operator: Operators are special symbols which perform some computation. Operators and operands form an expression. Python operators can be classified as given below:
Expressions : An expression in Python is any valid combination of operators, literals and variables.
>>> a = 1
>>> for a in range(3):
print(a)
Output
1
2
If we wanted to print 1 to 3, we could write the following code.
>>> for a in range(3):
print(a+1)
Output
1
2
3
e.g.
for i in range(1, 6):
for j in range (1, i)
print "*",
Tuples
Dictionaries
1 videos|26 docs|18 tests
|
|
Explore Courses for Humanities/Arts exam
|