Python Fundamentals - Tuples INTRODUCTION Tuples are very similar to lists, but tuples cannot be changed. That is, a tuple can be viewed as a "constant list". While lists use square brackets, tuples are written with standard parentheses or no parentheses, and elements are separated with comma as given in the following lists: # elements are written without parentheses ››› … [Read more...]
Python Fundamentals – Dictionaries
Python Fundamentals - Dictionaries INTRODUCTION A dictionary is like an address-book where you can find the address or contact details of a person by knowing only his/her name, i.e., we associate keys (name) with values (details). Note that the key must be unique just like you cannot find out the correct information if you have two persons with the exact same name. A … [Read more...]
Python Fundamentals – List Manipulation
Python Fundamentals - List Manipulation INTRODUCTION Like a string, a list is a sequence of values. In a string, the values are characters; in a list, they can be any type. The values in a list are called elements or sometimes items. Lists are more general than strings. Strings are always sequences of characters, whereas lists can contain values of any type. Lists can … [Read more...]
Python Fundamentals – Flow of Control
Python Fundamentals - Flow of Control CONTROL STATEMENTS Control statements define the direction or flow in which execution of a program should take place. Control statements also implement decisions and repetitions in programs. Control statements are of the following two types: Conditional branching Looping Conditional brandling, a program is to decide whether … [Read more...]
Python Fundamentals – Operators and Expressions
Python Fundamentals - Operators and Expressions OPERATORS An operator in Python, specifies an operation to be performed on the variables that yields a resultant value. An operand is an entity on which an operator acts. For example in the expression: a + b the sign + is an operator which specifies the operation of addition on the two operands a and b. Python language … [Read more...]
Python Fundamentals – String Manipulation
Python Fundamentals - String Manipulation WHAT IS A STRING? A string is a sequence of characters. Strings are basically just a bunch of words. Strings are the form of data used in programming for storing and manipulating text, such as words, names and sentences. You can write them in Python using quotes, double quotes, or triple quotes. . Single Quote You can … [Read more...]
Python Fundamentals – Data Types,Variables and Constants
Python Fundamentals - Data Types,Variables and Constants CONCEPT OF DATA TYPES The kind of data that a variable may hold in a programming language is called the data type. The ability to divide data into different types in Python enables you to work with complex objects. STANDARD DATA TYPES The data stored m memory can be of many types. For example, a person's age is stored … [Read more...]
Python Fundamentals – User Defined Functions
Python Fundamentals - User Defined Functions INTRODUCTION A user defined function represents a function which is named and provided by user or programmer to produce the desired and certain output. Figure 14.1 illustrates the sequence for the call to a function sqrt. The value of x (16.0) is the input, and the result after operation of the function sqrt() or output is the … [Read more...]
Python Fundamentals – Getting Started with Python
Python Fundamentals - Getting Started with Python WHAT IS A PROGRAM? A program is a sequence of instructions given to the computer. A programming language is something like a code for writing down the instructions that a computer will follow. In fact, programmers often refer to their programs as computer code, and the process of writing an algorithm in a programming language … [Read more...]
Python Fundamentals – Data Representation
Python Fundamentals - Data Representation INTRODUCTION We human beings commonly use the decimal number system consisting of digits 0,1, 2, 3, 4, 5, 6, 7, 8 and 9. But in computers, instructions as well as data are stored in binary form. The binary number system consisting of digits 0 and 1 because binary digits 0 and 1 can be easily created by an electrical switch. If … [Read more...]