Skip to main content

Posts

Python tutorial - #3 (Docstrings and Data-Type)

Docstrings = If we write string inside triple single quote (‘’’----‘’’) or triple double quote (“””----“””) and if these strings are written as first statements in a module, function, class or a method. Then these strings are called Documentation strings or simply Docstrings. These strings are useful to create an A.P.I documentation file from python program, An A.P.I (Application Programming Interface) documentation file is a text file or HTML file that contains the description of all features of software or product. When software is created it is the duty of programmer to create docstrings file in which they explain each and every class, Module, function etc. properly. It helps the user of the product (software) to use this smoothly. Representing Binary, Octal and Hexadecimal number. ➠In python, Binary number are represented by adding 0 (zero) B or 0 (zero) b as prefix to each binary number. Example: - 0B11001, 0b00101 etc.       ...

C tutorial #lecture4

Newline operator: It is a formatting operator used to make the text appear  on new line  It is always used between "&". Printf() and scanf() functions: When we calculate something say a particular sum or if we need to display something in the screen then we use printf () function.  To use this function we need to include <stdio. h> file first to use both functions. General format of printf is  Printf("<format strings>", <list of variables>) ; Format strings contain some format specifiers like given below: %f for printing real value.  %d for printing integer values  %c for printing character value.  Let's understand the use through the code: We are converting rupees into dollars source code Output.  Printf can not only print values of variables but it can also print results of an expression but using these expressions is optiional.  See the code below...

C tutorial #lecture 3

Here you will be introduced to the comments in C and some basic arithmetic operations on variables and you will learn various shorthand operators. Let's get started- Comments in C : Comments in C/C++ and in any other programming languages serve the purpose of improvement of readability of the code.  Comments are enclosed within /*-----------*/. This  symbol is used for multiline comments. For single line comments we use  // symbol  ( two backslashes) The rules of programming language aren't applicable within comments. The text doesn't appear in the output of the code but it appears in the source code. It just makes the program readable for the coder. This is a C code to illustrate comments.  Add caption       Output.  Nesting of comments : Comments written with /*----/*---*/--------*/  can't be nested and are invalid but a comment with  /*------//------*/ can be nested.  The f...

Python tutorial - #2 (Datatypes in Python)

GARBAGE COLLECTOR  (GC) Module  =  A module is a code that can perform an specific task. >>> In Python GC (Garbage Collector) is a module that helps to remove the unwanted objects during the execution. When a program execution takes place GC generate reference count to each object. Reference count means how many times the object execute. when an object has reference count of at least 1 then GC do not removes them but when an object has reference count of 0 then GC understands that object has not any use in program and GC removes them. In the given figure A, B and C are three object. when we execute this program then Python interpreter interperate from A object to B object and then execute C after that it passed to A object. Thus, A, B and C have reference count of 1. So, GC not removes them. COMMENT Observe the given program :- The First line of the given program starts with   ‘#’. This symbol represents  comment line ...