Posts

Showing posts from October, 2018

Sdlc Overview

SDLC, Software Development Life Cycle is a process used by software industry to desig n, develop and test hig h quality softwares. T he SDLC aims to produce a hig h quality software that meets or exceeds customer expectations, reaches completion within times and cost estimates. SDLC is the acronym of Software Development Life Cycle. It is also called as Software development process. T he software development life cycle (SDLC) is a framework defining tasks performed at each step in the software development process. ISO/IEC 12207 is an international standard for software life-cycle processes. It aims to be the standard that defines all the tasks required for developing and maintaining software. What is SDLC? SDLC is a process followed for a software project, within a software org anization. It consists of a detailed plan describing how to develop, maintain, replace and alter or enhance specific software. T he life cycle defines a methodolog y for improving the quality of software and th...

Python While Loop

A while loop statement in Python prog ramming lang uag e repeatedly executes a targ et statement as long as a g iven condition is true. Syntax: T he syntax of a while loop in Python prog ramming lang uag e is: while expression: statement(s) Here, statement(s) may be a sing le statement or a block of statements. T he c ondition may be any expression, and true is any non-zero value. T he loop iterates while the condition is true. When the condition becomes false, prog ram control passes to the line immediately following the loop. In Python, all the statements indented by the same number of character spaces after a prog ramming construct are considered to be part of a sing le block of code. Python uses indentation as its method of g rouping statements. Flow Diag ram: Here, key point of the while loop is that the loop mig ht not ever run. When the condition is tested and the result is false, the loop body will be skipped and the first statement after the while loop will be executed. E...

Python Variable Types

Variables are nothing but reserved memory locations to store values. T his means that when you create a variable you reserve some space in memory. Based on the data type of a variable, the interpreter allocates memory and decides what can be stored in the reserved memory. T herefore, by assig ning different data types to variables, you can store integ ers, decimals or characters in these variables. Assig ning Values to Variables: Python variables do not have to be explicitly declared to reserve memory space. T he declaration happens automatically when you assig n a value to a variable. T he equal sig n (=) is used to assig n values to variables. T he operand to the left of the = operator is the name of the variable and the operand to the rig ht of the = operator is the value stored in the variable. For example: #!/usr/bin/python counter = 100 miles = 1000.0 name = "John" # An integer assignment # A floating point # A string print counter print miles print name Here, 100, ...

Python Modules

A module allows you to log ically org anize your Python code. Grouping related code into a module makes the code easier to understand and use. A module is a Python object with arbitrarily named attributes that you can bind and reference. Simply, a module is a file consisting of Python code. A module can define functions, classes and variables. A module can also include runnable code. Example: T he Python code for a module named aname normally resides in a file named aname.py. Here's an example of a simple module, support.py def print_func( par ): print "Hello : ", par return The import Statement: You can use any Python source file as a module by executing an import statement in some other Python source file. T he import has the following syntax: import module1[, module2[,... moduleN] When the interpreter encounters an import statement, it imports the module if the module is present in the search path. A search path is a list of directories that the interpreter searches...

Python Loops

There may be a situation when you need to execute a block of code several number of times. In g eneral, statements are executed sequentially: T he first statement in a function is executed first, followed by the second, and so on. Prog ramming lang uag es provide various control structures that allow for more complicated execution paths. A loop statement allows us to execute a statement or g roup of statements multiple times and following is the g eneral form of a loop statement in most of the prog ramming lang uag es: Python prog ramming lang uag e provides following types of loops to handle looping requirements. Click the following links to check their detail. Loop T ype Desc ription while loop Repeats a statement or g roup of statements while a g iven condition is true. It tests the condition before executing the loop body. for loop Executes a sequence of statements multiple times and abbreviates the code that manag es the loop variable. nested loops You can use one or more...

Python Functions

A function is a block of org anized, reusable code that is used to perform a sing le, related action. Functions provide better modularity for your application and a hig h deg ree of code reusing . As you already know, Python g ives you many built-in functions like print(), etc. but you can also create your own functions. T hese functions are called user-defined functions. Defining a Function You can define functions to provide the required functionality. Here are simple rules to define a function in Python. Function blocks beg in with the keyword def followed by the function name and parentheses ( ( ) ). Any input parameters or arg uments should be placed within these parentheses. You can also define parameters inside these parentheses. T he first statement of a function can be an optional statement - the documentation string of the function or docstring. T he code block within every function starts with a colon (:) and is indented. T he statement return [expression] exits a function,...

Python for loop

T he for loop in Python has the ability to iterate over the items of any sequence, such as a list or a string . Syntax: T he syntax of a for loop look is as follows: for iterating_var in sequence: statements(s) If a sequence contains an expression list, it is evaluated first. T hen, the first item in the sequence is assig ned to the iterating variable iterating_var. Next, the statements block is executed. Each item in the list is assig ned to iterating_var, and the statement(s) block is executed until the entire sequence is exhausted. Flow Diag ram: Example: #!/usr/bin/python for letter in 'Python': # First Example print 'Current Letter :', letter fruits = ['banana', 'apple', 'mango'] for fruit in fruits: # Second Example print 'Current fruit :', fruit print "Good bye!" When the above code is executed, it produces the following result: Current Current Current Current Current Letter Letter Letter Letter Letter : : : : : P...

Python Files

T his chapter will cover all the basic I/O functions available in Python. For more functions, please refer to standard Python documentation. Printing to the Screen: T he simplest way to produce output is using the print statement where you can pass zero or more expressions separated by commas. T his function converts the expressions you pass into a string and writes the result to standard output as follows: #!/usr/bin/python print "Python is really a great language,", "isn't it?"; T his would produce the following result on your standard screen: Python is really a great language, isn't it? Reading Keyboard Input: Python provides two built-in functions to read a line of text from standard input, which by default comes from the keyboard. T hese functions are: raw_input input The raw_input Function: T he raw_input([prompt]) function reads one line from standard input and returns it as a string (removing the trailing newline). #!/usr/bin/python str = raw_inp...

Python Dictionary

A dictionary is mutable and is another container type that can store any number of Python objects, including other container types. Dictionaries consist of pairs (called items) of keys and their corresponding values. Python dictionaries are also known as associative arrays or hash tables. T he g eneral syntax of a dictionary is as follows: dict = {'Alice': '2341', 'Beth': '9102', 'Cecil': '3258'} You can create dictionary in the following way as well: dict1 = { 'abc': 456 }; dict2 = { 'abc': 123, 98.6: 37 }; Each key is separated from its value by a colon (:), the items are separated by commas, and the whole thing is enclosed in curly braces. An empty dictionary without any items is written with just two curly braces, like this: {}. Keys are unique within a dictionary while values may not be. T he values of a dictionary can be of any type, but the keys must be of an immutable data type such as string s, numbers, or tup...

Python Basic Operators

What is an operator? Simple answer can be g iven using expression 4 + 5 is equal to 9. Here, 4 and 5 are called operands and + is called operator. Python lang uag e supports the following types of operators. Arithmetic Operators Comparison (i.e., Relational) Operators Assig nment Operators Log ical Operators Bitwise Operators Membership Operators Identity Operators Let's have a look on all operators one by one. Python Arithmetic Operators: Assume variable a holds 10 and variable b holds 20, then: [ Show Example ] O perator Desc ription Example + Addition - Adds values on either side of the operator a + b will g ive 30 - Subtraction - Subtracts rig ht hand operand from left hand operand a - b will g ive -10 * Multiplication - Multiplies values on either side of the operator a * b will g ive 200 / Division - Divides left hand operand by rig ht hand operand b / a will g ive 2 % Modulus - Divides left hand operand by rig ht hand operand and returns remainder b % a w...

Yaala & Kirinda, Srilanka

Image

Diyaluma, Srilanka

Image

Riverston, Mathale, Srilanka

Image

Meemure, Srilanka

Image