create account

Python Keywords and Identifiers (3rd part) by alrashel

View this thread on: hive.blogpeakd.comecency.com
· @alrashel · (edited)
$2.05
Python Keywords and Identifiers (3rd part)
> Here I published the 3rd part of the consecutive series about Python Programming language to learn for all. Please check the previous parts. 

#### Previous 
###### [Python Programming Language (1st part)](https://hive.blog/hive-122108/@alrashel/python-programming-language-1st-part)
###### [Variables Assignment In Python Programming Language (2nd part)](https://hive.blog/hive-122108/@alrashel/variables-assignment-in-python-programming-language-2nd-part)


![code-1084923_1280.png](https://images.hive.blog/DQmUZ6UfTSYvnT52mhXuoTfb5LG8TXNHfJ8BVktt7zkXhAh/code-1084923_1280.png)
[Source](https://pixabay.com/photos/code-programming-python-1084923/)

Each Programming language has its own syntax and structure . To define these syntaxes and structure reserved words are used. Python Programming language is no exception. There are 35 keywords in Python 3.8, each serving a different meaning for a different purpose. 

Every keyword is a  part of the vocabulary of the Python Programming language. So we can't use these keywords for defining names of variables, classes or functions. 

Python keywords are case sensitive, which means they must be written as they are while we using them in our code. 

To get the keywords list, open Python IDLE (windows) and type *"help()"* and hit enter. Type *"keywords"*, voila! you can see now the whole python keywords list.

![keywords1.JPG](https://images.hive.blog/DQmTh64JQVdkem9Dbf9kmsbd7dpE1HaV1q36No3zNjCTDcj/keywords1.JPG)

We can also use Python's keyword module to get the list.

![keywords2.JPG](https://images.hive.blog/DQmVkWQh7DM9AjVXmA5DmsALjyHtMBZQ8xP6MpuK9RLZdwg/keywords2.JPG)

To know about a specific keyword and its usage, type its name on the help mode and hit enter.

![keywords3.JPG](https://images.hive.blog/DQmTnTbNWEB3sH7x7gm9yz4tmugV8Ax7AcaYN5biVz6wrBy/keywords3.JPG)

## Example of keyword : 
Using “while” keyword we can run a loop in a code block for displaying the values of a variable.
 ````ruby 
  a = 12
  while a>3:
	print(a)
	a -= 1
 ````
Type on your Python IDLE and see.
Don't worry we will discuss details in the coming sections. 
![example1.JPG](https://images.hive.blog/DQmZtTgDitXt1jaVT4yqT4Yg6kQYQ57948YbTTKzM98j5hi/example1.JPG)

## Python Identifiers
When we assign a name to a variable, function, class, module or any other programmable entity, then it is called an identifier. 

Python language has a set of rules to create identifiers.

#### Rules:
1. A valid identifier can only have a combination of letters either in lowercase(a to z) or uppercase(A to Z) or digits(0 to 9) or underscore (__).
 num, num1, num_1, numTwo are valid identifiers example.
2. The name of an identifier can't start with a digit. For example: 
1num is not a valid identifier name, but num1 is a valid one. 
3. Keywords can't be used as valid identifiers' names.
4. Avoid special characters ['$', '%', '.', '@', '!' ] for naming a valid identifier.
5. A valid identifier can have an unlimited length of the sequence of the characters.   

we should aware that Python language is case sensitive. So, the identifier 'name' and 'Name' are not the same. 
 ........................................

   I hope that dear readers understand what has been discussed so far about today's topic.                            

#### Next
*Python Data Types*
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 37 others
properties (23)
authoralrashel
permlinkpython-keywords-and-identifiers-3rd-part
categoryhive-122108
json_metadata{"tags":["steem","hive","programming","python","writing","education4all","learn"],"image":["https://images.hive.blog/DQmUZ6UfTSYvnT52mhXuoTfb5LG8TXNHfJ8BVktt7zkXhAh/code-1084923_1280.png","https://images.hive.blog/DQmTh64JQVdkem9Dbf9kmsbd7dpE1HaV1q36No3zNjCTDcj/keywords1.JPG","https://images.hive.blog/DQmVkWQh7DM9AjVXmA5DmsALjyHtMBZQ8xP6MpuK9RLZdwg/keywords2.JPG","https://images.hive.blog/DQmTnTbNWEB3sH7x7gm9yz4tmugV8Ax7AcaYN5biVz6wrBy/keywords3.JPG","https://images.hive.blog/DQmZtTgDitXt1jaVT4yqT4Yg6kQYQ57948YbTTKzM98j5hi/example1.JPG"],"links":["https://hive.blog/hive-122108/@alrashel/python-programming-language-1st-part","https://hive.blog/hive-122108/@alrashel/variables-assignment-in-python-programming-language-2nd-part","https://pixabay.com/photos/code-programming-python-1084923/"],"app":"hiveblog/0.1","format":"markdown"}
created2020-04-14 00:56:30
last_update2020-04-14 04:59:39
depth0
children2
last_payout2020-04-21 00:56:30
cashout_time1969-12-31 23:59:59
total_payout_value1.030 HBD
curator_payout_value1.021 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length3,311
author_reputation2,707,464,674,673
root_title"Python Keywords and Identifiers (3rd part)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id96,831,504
net_rshares7,240,803,075,701
author_curate_reward""
vote details (101)
@cmplxty ·
I would consider adding the stem tag to one of the ones you use. I think the stem community here would love to see these types from you!

I have on my list of things to do soon, learn python. It’s pretty straight forward from what I hear. I tried to do c++ but it was brutal. 

I’ll read up on your other ones!
👍  
properties (23)
authorcmplxty
permlinkre-alrashel-q8r77m
categoryhive-122108
json_metadata{"tags":["hive-122108"],"app":"peakd/2020.03.14"}
created2020-04-14 01:09:21
last_update2020-04-14 01:09:21
depth1
children1
last_payout2020-04-21 01:09:21
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length310
author_reputation778,740,473,087,209
root_title"Python Keywords and Identifiers (3rd part)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id96,831,591
net_rshares531,406,325
author_curate_reward""
vote details (1)
@alrashel ·
Thanks for your attention and I'll follow your suggestion.
properties (22)
authoralrashel
permlinkq8ravg
categoryhive-122108
json_metadata{"app":"hiveblog/0.1"}
created2020-04-14 02:28:30
last_update2020-04-14 02:28:30
depth2
children0
last_payout2020-04-21 02:28:30
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length58
author_reputation2,707,464,674,673
root_title"Python Keywords and Identifiers (3rd part)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id96,832,097
net_rshares0