Page 430 - AI Ver 3.0 class 10_Flipbook
P. 430
[1]: """This program calculates
the average of marks of
two subjects of a student"""
eng=91
maths=93
c=(eng+maths)/2
Keywords
Keywords have special meaning which are reserved by Python for special purposes and are not allowed to be
used as identifiers. They are case sensitive. We can see the list of the reserved keywords by giving the following
command at the Python command prompt:
import keyword
keyword.kwlist
Following is the list of keywords displayed by giving the above commands:
False class finally is return
None continue for lambda try
True def from nonlocal while
and del global not with
as elif if or yield
assert else import pass async
await break except in raise
Identifiers
Identifiers are the user-defined names of variables, lists, classes, functions, dictionaries, tuples, etc., which are
used to identify an element in Python.
Naming the identifiers follows rules as given below:
• An identifier can have letters in uppercase or lowercase, numbers or underscore(_).
• It can start with an alphabet or an underscore.
• No special characters like $, period(.), space, etc. are allowed.
• It should not be a Python keyword.
• They are case sensitive. Uppercase and lowercase letters are different.
• Identifiers can be of any length.
Some of the examples of valid identifiers are: Num1, First_Name, Value, Scores_FirstTerm.
Some of the examples of invalid identifiers are: 1stsubject, My name, #mobile, City&Code, and True.
Variables
Variable is a name given to a memory location to hold a specific value. It is just like a container that can hold any
type of data that can be changed later in the program. Variable has:
• A name that follows the rules of identifier naming conventions and is case sensitive.
• A value that can be integer, float, string, boolean, etc.
428 Touchpad Artificial Intelligence (Ver. 3.0)-X

