Why Python Programming language is so important?
Features of Python:
1) It is a high level language.
2) It is free and open source language.
3)It is platform independent language.
4) It is interpreted language.
5) It is easy to use and understandable language.
What is token in Python programming language?
![]() |
Tokens in Python |
as |
Not |
Continue |
Try |
for |
While |
None |
False |
assert |
Import |
Else |
Break |
Class |
def |
Try |
Or |
With |
And |
Finally |
Not |
elif |
2) Identifiers: An identifier is defined to declare as variable, function, class, and object. Keywords can’t be used as identifiers. It can be declared by using character, number except underscore.
3) Literals: Literals are the values which are given in a program. It could be string literals, number literals, Boolean literals, and special literals.
4) Operators: Operators are the symbols which perform operations on values. There are different types of operators like maths operators, logical operators, and relation operators.
5) Punctuators: Punctuators are the symbols which add meaning in a code. There are many Punctuators like {}, (), ;, “” @, ?, : etc.
Write a program to find area of a rectangle where length = 25 cm and breadth = 2 cm.
What are the different data types used in Python?
![]() |
Data Type in Python |
Data |
Description |
Example |
Integer |
stores whole numbers |
B = 6 |
String |
stores text enclosed in single or double quotes |
Subject=’Hindi’ |
List |
stores list of values of any data type separated with comma between square[] |
List=[34,12.5,”maths”,”Hindi”] |
Tuple |
stores list of values of any data type separated with comma between parentheses() |
tuple=(34,12.5,”maths”,”Hindi”) |
Set |
stores unordered set of values of any data type with no duplicate between braces{} |
set={34,12.5,”maths”,”Hindi”} |
Dictionary |
stores unordered set of comma separated key: value pairs between braces |
Dic={1:”one”, 2:”two”} |
Float |
Stores numbers with fraction |
B=23.6 |
Complex |
Stores a number have real and imaginary part |
No=a+bc |
Boolean |
It has two values true & false |
Result=false |
How values are accepted from user in Python?
Program 2:
Write a program to accept name, three subjects marks, and find total of it.
No comments:
Post a Comment