python fundamentals

Python Fundamentals and Character sets

What is interactive mode?

Interactive mode is used to write single-line code. It is useful when a user wants immediate results. This is a type of interpreter. The interpreter is of two types such as interactive mode and script mode. Interactive mode can be defined a shell mode. It includes an operator (<<<) which is known as a prompt string. This basically waits for the input. The interactive mode works well on single-line code instead of multi-line code. But, the interactive mode does not edit any code. If any code is executed and the user wanted to edit the previous code then it cannot be done in interactive mode. Users need to write the code again.

 

What is script mode?

Script mode is used to write multiple lines of code. This is a type of interpreter. It is much better than interactive mode. In script mode, firstly need to save the file with ‘.py’. It can edit any code. In script mode, code can be of single line and multiple lines.

Python interactive mode

What is Python character set?

Character set is a set of valid characters recognized by python. A character represents any digit, letter, or other symbol.

  • It includes letters such as A-B, a-b. Python is case-sensitive. So, there are differences between capital and small letter.
  • It include digits between 0 to 9. It include special symbols such as space, +, -, /, *, \, **, (), {}, //, =, !, ==, <,>,””, ”, :, ;, %, #, ?, $, &, ^, <=, >=, @ and _.
  • It includes white spaces such as blank, space, tabs, enter, newline, and form feed.
  • It includes other characters such as all other 256 ASCII and Unicode characters.

python character set

Types of Python character set

There are the following types of python character sets such as

  • Token
  • Identifier
  • Keyword
  • Literal
  • Operator

1. Token

A token is defined as the basic and smaller elements of a program. For example

A = 40+50+60

So., A, 40, 50, 60 these are the tokens. There are the following types such as identifier, keywords, literals, operator, and delimiters.

2. Identifiers

The identifier is defined as the name of any class, variable and function etc. Identifiers can include numbers, letters, and the underscore character (_). Python is a case-sensitive language. Case-sensitive programming language is defined as the difference between capital letters and small letters. For example, if we have assigned two values into the same alphabet but their size is different. One is capital and the other is smaller. So, it will read both differently.

a= 5

A= 6

print(a)

5

print(A)

6.

3. Keywords

Keywords are words that are already reserved for some particular purpose. The name of these keywords should not be used as identifiers. Keywords are known as reserved words. Keywords cannot be used as identifiers. Each keyword has some particular purpose such as import, print, False, None, True, and class.

4. Literals

Literals are the raw data given in variables.

5. Operator

The operator is the special character or symbol which is used for mathematical operations.

Previous articleVictim of Cyber Fraud Getting Money Back
Next articleWhat is Spyware? How To Protect From Spyware

LEAVE A REPLY

Please enter your comment!
Please enter your name here