Python- Review- Lesson no-2
Good Morning Dear Students
The correct responses of the worksheet shared yesterday are as follows (in Maroon color):
1. Python is A high level language.
2.Python uses an interpreter.
3. Following are true for Python
I hope you have a better understanding of the basic concepts of Python now.
______________________________________________________________________________
The correct responses of the worksheet shared yesterday are as follows (in Maroon color):
1. Python is A high level language.
2.Python uses an interpreter.
3. Following are true for Python
- Is simple
- Platform independent and portable
- Has a huge Library
- Keywords
- operators
- punctuators
- are special words which are reserved by Python .
- are not allowed to be used as variables in Python.
- are case-sensitive.
I hope you have a better understanding of the basic concepts of Python now.
______________________________________________________________________________
By the end of this session, you will be able to
Today our focus will be the concept of identifiers.
(Please take down the following concepts in your registers):
- Define the term "Identifiers"
- Identify the rules to define identifiers
- Define identifiers as per the need of the program.
- Identify VALID and INVALID identifiers
Today our focus will be the concept of identifiers.
(Please take down the following concepts in your registers):
As you know that identifiers are
- very important in programming.
- the building blocks of a program.
- So we need to create them wisely.
RULES to follow while defining identifiers
1.
1. Identifiers can be a
combination of letters in lowercase (a to z) or
uppercase (A to Z) or digits (0 to 9) or an underscore _ Names
like myClass, var_1 and print_this_to_screen, all are valid example.
1 2. An identifier cannot
start with a digit. eg. 1variable is invalid,
but variable1 is perfectly fine.
2 3. Keywords cannot be
used as identifiers. eg. print cannot be used as an identifier.
3 4. We cannot use special
symbols like !, @, #, $, % etc. in our
identifier. The only symbol allowed is the underscore i.e. "_" eg. var_1
4 5. An identifier can be of
any length.
1. Python is a case-sensitive language. This means, Variable and variable are not the same. Always name
identifiers that make sense.
2. While, c = 10 is valid.
Writing count = 10 would make more
sense and it would be easier to figure out what it does even when you look at
your code after a long gap.
3. Multiple words can be separated using an underscore, this_is_a_long_variable.
The
following are some VALID identifiers:
MyFile
MYFILE
CHK
Z2t0Z29
DATE9_7_77
_DS
FILE13
HJI3_JK
The
following are some INVALID identifiers( along with the reason):
DATA-REC- contains special character – (hyphen) (other than A-Z,a-z,_(underscore))
29CLCT- starting with a digit
break - reserved word
My.file –
contains special character dot (.)
EXERCISE
Q1. Find
whether the following Python identifiers are valid or not. Give reasons, if not
valid:
1. happy_10
2. For
3. for
4. 10find
5. Count
6. Count 1
7. cout@1
8. 1count
9. Count_1
10. if
11. if#
12. while
13. while 2
14. while_2
15. while.nd
16. while2
1. happy_10
2. For
3. for
4. 10find
5. Count
6. Count 1
7. cout@1
8. 1count
9. Count_1
10. if
11. if#
12. while
13. while 2
14. while_2
15. while.nd
16. while2
Please do the above exercise in your notebook. We will discuss the answers tomorrow.
Good Morning. Please mark your attendance as you come.
ReplyDeletegood morning mam
ReplyDeleteashish -present
Good morning ma'am
ReplyDelete-Geet
This comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteGood morning ma'am
ReplyDeleteEMMANUEL _ present
pushkar
ReplyDeletegood morning mam
good morning mam-Aaron David
ReplyDeleteGood morning ma'am
ReplyDeleteMa'am i've finished the work
ReplyDelete-Geet
Ma'am I am present ~ EMMANUEL
ReplyDeleteMam I 've finished my work
ReplyDelete-ashish
proud of you.
DeleteI am present
ReplyDeleteClement
Good morning ma'am
ReplyDelete- rahul
Are there any doubts. This is a very important concept. Tomorrow we will start building the programs
ReplyDeleteThere was some technical glitch because of which I couldnt see the comments. From tom pls mark your presence as u join class.
ReplyDeleteAlso, all written work to be done in the register including the solution of the online test. We may not get time to revise all the topics we are doing now.
ReplyDeleteGood morning. Who is this please
ReplyDeleteok ma'am
ReplyDelete-Geet
pushkar nagaliya
ReplyDeletemam i done my work
Great Pushkar. proud of you.
Delete