Posts

BASIC DATA TYPES IN PYTHON

Image
  NUMERIC Numeric data can be broadly divide into integers and real numbers (i.e. fractional numbers). Integers can themselves be positive and negative. Unlike many other programming languages, Python does not have any upper bound on the size of integers. The real numbers or fractional numbers are called floating point numbers in programming languages. Such floating point numbers contain a decimal and a fractional part. Let us look at an example that has an integer as well as a real number: STRING A String in Python can be a series or a sequence of alphabets, numerals and special characters. Similar to C, the first character of a string has an index 0. Single quotes or double quotes are used to represent strings.   There are many operations that can be performed on a string. There are several operators such as slice operator ([] and [:]), concatenation operator (+), repetition operator (*), etc. Slicing is used to take out a subset of the string, concatenation is us...

DATA TYPES IN PYTHON

  STANDARD DATATYPES Data types are the classification of categorization of data items which represents the kind of value that tells what operations can be performed on a particular data. The data stored in memory can be of many types. For example, a person’s name is stored as an alphabetic value and his address is stores as an alphanumeric value. Sometimes we also need to store answer in terms of only ‘yes’ or ‘no’ , i.e. true or false( This type of data is known as Boolean data ). Python has six basic data types, which is as follows: 1. Numeric 2. String 3. List 4. Tuple 5. Dictionary 6. Boolean

VARIABLES IN PYTHON

Image
  VARIABLES DECLARING A VARIABLE A variable holds a value that may change. The process of writing the variable name is called Declaring the variable . In Python, variables do not need to be declared explicitly in order to reserve memory spaces as in other programming languages like C, java etc. When we initialize the variable in Python, Python interpreter automatically does the declaration process.   INITIALIZING A VARIABLE The general format of assignment statement is as follows: The equal sign (= ) is known as Assignment operator. An expression is any value, text or arithmetic expression, whereas variable is the name of the variable. The value of the expression will be stored in the variable. Examples of variable initialization : The above statements reserve two memory spaces with variable names year and name. 2020 and John are stored respectively in these memory spaces as shown below: Whenever we want to display the value of the variable, simply type these varia...

COMMENTS, IDENTIFIERS AND KEYWORDS IN PYTHON

Image
  COMMENTS Python allows you to add comments in the code as other programming languages do. Comments are used by the programmer to explain the piece of code to others as well as to himself in a simple language. Every programming language uses special character for commenting, so does Python.   Python uses hash character (# ) for comments. Putting # before a text ensures that the text will not be parsed by the interpreter. Comments do not affect the programming part and the Python interpreter does not display any error message for comments. Comments show up as it is in the programming. It is a good practice to use comments for program documentation in your program so that it becomes easier for other programmers to maintain or enhance the program when required. PYTHON IDENTIFIERS A Python identifier is the name given to a variable, function, class, module or other object. An identifier can begin with an alphabet (A –Z or a -z ), or an underscore (_) and can include any nu...

INTRODUCTION TO PYTHON

Python is a high-level, interpreted, general-purpose, dynamic programming language. Python possesses a property of code termed reusability. The syntax of python programs can express concepts in fewer lines as compared to programs in C, C++ and JAVA.   Python can be used in multiple programming styles, including Object-Oriented, Functional programming, Procedural Programming and Imperative styles. It also supports automatic memory management and has a large standard library and innumerous set of third party libraries. Python can be used on almost every operating system because its interpreter is available for many operating systems. It is a free and open- source software(Open-source software is a kind of computer software in which the source code of the software is made public, i.e., the copyright holder gives rights to everyone to read, change and distribute the code for any purpose ). KEY FEATURES OF PYTHON ·          The code writt...

Computer Science Lecture Notes for Degree Students

Image
Myself C P Fathimathul Misiriya, MSc. Computer Science Graduate.  I am writing this blog in a motive to be a helping hand for the computer science students.When I was doing my studies, I found it difficult in preparing notes from the textbooks, Since we have to cover lot of topics within less time.  We used to skip certain topics during exams without knowing its importance.  And I used to search for getting one which makes my studies easier.  So here I would like to share with you notes which I have created by referring Computer Science textbooks.  Hope it would help and make your studies easier.