Notes 230714 155034 2d8
Notes 230714 155034 2d8
of python prompt in the Python shell Python Python carry out the result in the Python shell itself
on the other hand the script mode allow you to write a block of code as the Python interpreter
debugs the code line by line and produce output on the Python shell
Data type
The data stored in memory can be of many types. For example, a student roll number is stored
as a numeric value and his or her address is stored as alphanumeric characters. Python has
various standard data types that are used to define the operations possible on them and the
storage method for each of them.
Int, or integer, is a whole number, positive or negative, without decimals, of unlimited
length.
Float , string:
Float, or "floating point number" is a number, positive or negative, containing one or more
decimals.
Float can also be scientific numbers with an "e" to indicate the power of 10.
Strings in Python are identified as a contiguous set of characters represented in the quotation
marks. Python allows for either pairs of single or double quotes.
• 'hello' is the same as "hello".
• Strings can be output to screen using the print function. For example: print("hello").
Variables
Variables are nothing but reserved memory locations to store values. This 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.
Therefore, by assigning different data types to variables you can store integers, decimals or
characters in these variables.
Rules for Python variables:
• A variable name must start with a letter or the underscore character
• A variable name cannot start with a number
• A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9,and _ )•
Variable names are case-sensitive (age, Age and AGE are three different variables)
features of python
1. Free and Open Source
Python language is freely available at the official website and you can download it from the
given download link below click on the Download Python keyword. Download Python Since it is
open-source, this means that source code is also available to the public. So you can download it,
use it as well as share it.
2. Easy to code
Python is a high-level programming language. Python is very easy to learn the language as
compared to other languages like C, C#, Javascript, Java, etc. It is very easy to code in the
Python language and anybody can learn Python basics in a few hours or days. It is also a
developer-friendly language.
3. Easy to Read
As you will see, learning Python is quite simple. As was already established, Python’s syntax is
really straightforward. The code block is defined by the indentations rather than by semicolons
or brackets.
4. Object-Oriented Language