Basic elements of Python
# Character sets- These refers to the set of valid characters that python recognises for writing programs.
*Types of character sets->
- Letters- Includes uppercase(Capital alphabets), Lower case(Small alphabets). EX- A,B,C...a,b....z.
- Digits- Includes numeric values. EX- 12,8,3,...9.0...
- Special characters- Symbols used in programming. EX- +,*,-,/,3,$,&,!.
- Escape sequence- Represents special characters. EX- \n( new line), \t(tab), (\\ backslash).
- WhiteSpace characters- Used for space in coding. EX- ( ), newline().
# VARIABLES ; In python it is used to store a Data values, Which can be accessed and processed out throughout the program.
- These are created by assigning value to a name by using (=) operator. EX- x=10.
- Variables in python are not usually declared with the data types . It automatically encounters the data type of a variable.
- Variables names must starts with letter or an underscore. Other types of character sets are not allowed.
- EXAMPLE - x=10, a= "SATYAM " etc.
- Python supports different types of variables like integers,Float(Decimal values),strings, Lists, Dictionaries.etc
* Rules for Identifiers ->
- It may be a combination of uppercase, Lowercase, Digits and Underscore.
- It cannot start with digits. so, 1variable is not correct, variable1 is correct.
- It can be of any length.
- We cant use special symbols like @,#,$,%, etc.
Integers.
String.
Float .
Boolean.
None.
#KEYWORDS- These are the reserved or pre-defined words and cant be used as identifiers.
- These are case sensitive.
- They cant be used as naming variables.
#OPERATORS- An operator is a symbol that performs a certain operation between operands.
#TYPES OF OPERATORS-- Arithmetic Operators ( + , - , * , / , % , ** )
- Relational / Comparison Operators ( == , != , > , < , >= , <= )
- Assignment Operators ( = , +=, -= , *= , /= , %= , **= )
- Logical Operators ( not , and , or )
#INPUT IN PYTHON- input( ) statement is used to accept values (using keyboard) from user.
- input( ) #result for input( ) is always a str.
- int ( input( ) ) #int.
- float ( input( ) ) #float.

Comments
Post a Comment