You are currently viewing Python Fundamentals: Beginners concepts
Learn basic points in python for beginners

Python Fundamentals: Beginners concepts

Hello, my all dear visitors! Again, Your most welcome in this blog post on bittutech. Once again, I am going to write an interesting article post for you to enhance your technical skill. I hope, you all are very excited to read this blog post and give me golden feedback to encourage my blogging skill.

Today’s blog post is fully dedicated to Some fundamentals of Python like Character sets in Python, Some Tokens in Python and many more. So, here we go!!!

PYTHON CHARACTER SET

Character set is a set of valid characters that a language can recognize. A character represent any letter, digit or other symbols. Python also supports Unicode encoding standard. That means Python has the following character set–:

  • Letters-:  A-Z, a-z
  • Digits–: 0-9
  • Special symbols–: space, +, -, *, /, **, \, ( ), { }, [ ], //, =, !=, ==, <, >, ‘, “, ”’ etc.
  • Whitespace–: blank space, tabs, carriage return, newline, formfeed.
  • Other characters–: Python can process all ASCII and Unicode characters as part of data and literals.

TOKENS

In a passage of text, individual words and punctuation marks are called tokens or lexical units or lexical elements. The smallest individual unit in a program is known as token or a lexical unit.

Tokens are smallest individual units in a program.

Python has following tokens–:

  1. Keywords
  2. Identifiers ( Names )
  3. Literals/ Values
  4. Operators
  5. Punctuators

Let see these one by one. 👀 👉

1. Keywords

Keyword are also known as reserved words or predefined words. It can be used into Python programs. It cannot be used for declaring variables or identifiers.

Python Programming Language contains the following keywords –:

Python keywords.

2. Identifiers ( Names )

Identifiers means any name that identifies the memory location to locate the value and assign the value through the users program. In Python Programming Language identifiers are mainly used to store the value directly into the computers memory and fetch the value through them.

For Example–:

Apple= 40
Mango= 30

Here, Apple and Mango is an identifier that identify the value 40 and 30 respectively.

Some notable points–:

  • The first character must be a letter not any digits or symbols.
  • Upper and lower-case letters are different. All characters are significant.
  • An identifier must not be a keyword of Python.
  • An identifier cannot contain any special character except for underscore ( _ ) and remember that the underscore ( _ ) count as a letter.
  • An identifier is a long sequence of letters and digits.
  • The digits 0 – 9 can be part of the identifier except for the first character.

Here, Example of some valid identifiers –:

Myfile
MYFILE
Z2T0Z9
_DS
FILE123
HELLO_JK

3. Literals/ Values

Literals are data items that have a fixed/constant value.

There are several types of literals that are used into Python Programming Language.

3.1 String Literals

String literals are those types of literals that are assigned with single ( ‘ ‘ ) double ( ” ” ) and triple ( ”’ ”’ ) inverted commas.

Nongraphic character–: Non graphic character are those character that cannot be typed directly from keyboard. e.g., backspace, tabs etc. It means no character is typed when these keys are pressed only some action take place. For representing this we can use escape sequence. A escape sequence is represented by backslash ( \ ) .

Escape sequence in Python.

String Types in Python

Python have two string types–:

i). Single-line Strings (basic strings)–: The text that enclosed in single quotes ( ‘ ‘ ) or double quotes ( ” ” ) are normally Single line Strings.

For Example–:

Text1= "Hello!! Techies"

Note: At the end of line, if there is no closing quotation mark for an opened quotation mark, Python shows an error. So always remember to write strings in single or double inverted commas, and not forget to close it.

ii). Multiline Strings–: Multiline strings can be created in two ways–:

a) By adding a backslash ( \ ) at the end of normal single quotes or double quotes strings. By adding a backslash ( \ ) at the end of line allows you to continue typing text in next line.

Do not forget to close the string by having a closing quotation mark.

For Example–:

Text1= 'Hello\
World'

b) By typing that text in triple quotation mark or triple invited comma ( ”’ ”’ ) .

For Example–:

Str1 = ''' Hello
World.
There I come!!!
Cheers.
'''

Or

Str2 = """Hello
World."""

Size of Strings

Python determines the size of string as the count of characters in the string. Make sure to count the escape sequence as one character.

For multiline strings created with triple quotes, while calculating size the EOL ( end of line ) character at the end of the line is also counted in the size.

For Example–:

Remember that–: Backslash ( \ ) at the end of intermediate lines are not counted in the size of the multiline strings.

NOTE-: Use len (<object name>) to get the size or length of an object.

3.2 Numeric Literals

The numeric literals in Python can belong to any of the following three different numerical types–:

Integer Literals

These are the type of literals that are positive or negative whole numbers with no decimal points, called integers or ints.

E.g., 123, 156, 8AC etc.

Python allows three types of integer literals–: 

  1. Decimal integer literals
  2. Octal integer literals
  3. Hexadecimal integer literals

Floating point literals

Floating literals are also called a real literals. Real literals are numbers having fractional parts.

These literals may be written in two form called Fractional form or Exponent form.

i). Fractional Form–: Real constant in fractional form must have at least one digit with the decimal point either before or after. It may also have either plus (+) or negative (-) sign preceding it.

NOTE-: Real constant with no sign is assumed to be positive (+) .

E.g., 2.0, 17.5, -13.0, – 0.00612 etc.

ii). Exponent Form–: Real constant in exponent form has two parts–  mantissa and an exponent. The mantissa is followed by a letter ‘E’ or ‘e’ and the exponent must be an integer.

E.g., 152E05, 1.4E76, – 0.172E etc.

3.3 Boolean Literals

A Boolean Literal in Python is used to represent one of the two Boolean value i.e., True/ False . Or those types of laterals in which only two values can be declared ( True/False ) .

3.4 Special Literal

Python has one Special Literal, which is ‘None’. The None lateral is used to indicate absence of value. It also used to indicate the end of lists in Python Programming Language.

‘None’ value in Python means “there’s nothing here” . Python does not display anything when ask to display the value of the variable containing value as ‘None’.

4. Operators

Operator are those type of token that are applied onto variables or objects to perform mathematical and logical task. Operators and variables are combined together to form an expression.

Read more blog post -:

[Instagram Hack]|HiddenEye Hacking Instagram With Kali Linux 2020
How to install Linux OS on your android device?
How to Spy on Someone using (MITM) Man in the Middle attack?
How to Hack Someone’s Wi-Fi Password with aircrack-ng tool
Advance Jamming: Jam Wireless Network using MDK3 tool with Kali Linux
How to Jam Wireless Network(Wi-Fi) with Kali Linux | 2020
Top 10 Commands for Kali Linux Users || 2020
How to Split single Kali Linux terminal into multiple
How to hack Bluetooth devices?
How to download Instagram stories, reels, posts
How to Record WhatsApp Video Call in an Android mobile phone?.
How to create a youtube video thumbnail in ms paint?
How to schedule a WhatsApp message?
How to chat offline with your friends on WhatsApp?
Top 5 Entertainment Apps for Android Users: Short break from Study
What is the Multiplexing technique: Computer Networking Concept
How to create a YouTube channel playlist from mobile phones or PC?

4.1 Unary Operators

Unary Operators are those operators that require one operand( variables and objects to which the computation is applied ) to operate upon.

For Example–:

  • + (Unary plus)
  •    (Unary minus)
  • ~   (Bitwise complement)
  • not ( logical negation)

4.2 Binary Operators

Binary operators are those operators that require two operand to operate upon.

Arithmetic Operations

  • +  (Addition)
  • *   (Multiplication)
  •     (Subtraction)
  • /    (Division)
  • % (Remainder/ Modulus)
  • ** (Exponent)
  • // (Floor division)

Bitwise Operators

  • ^  (Bitwise exclusive OR (XOR))
  • |  (Bitwise OR)
  • &  (Bitwise AND)

Shift Operators

  • << (Shift left)
  • >> (Shift right)

Identity Operators

  • is (is the identity same?)
  • is not (is the identity not same?)

Relational Operators

  • < (Less than)
  • > (Greater than)
  • <= (Less than or equal to)
  • >= (Greater than or equal to)
  • == (Equal to)
  • != (Not equal to)

Assignment Operators

  • = (Assignment)
  • /= (Assign quotient)
  • += (Assign sum)
  • *= (Assign product)
  • %= (Assign remainder)
  • -= (Assign difference)
  • **= (Assign Exponent)
  • //= (Assign Floor division)

Logical Operators

  • and (Logical AND)
  • or (Logical OR)

Membership Operators

  • in (whether variable in sequence)
  • not in (whether variable not in sequence) 

5. Punctuators

Punctuators are symbols used to organize programming-sentence structures and indicate the rhythm and emphasis of expressions, statements and program structure.

Most common punctuate of Python Programming Language are:-

‘, “, #, \, ( ), [ ], { }, @, , :, ., =, `

Last words-: So this is all about Python fundamentals. I hope you enjoyed this blog post. Thank you so much for your love and support, we’ll meet soon till then, keep learning and keep exploring. :⁠-⁠)

Share post

Prajjwal Singh

Tech Blogger || Web developer || Computer Networking Enthusiast || Microsoft SQL Database Management Expert || Software Debugger || Learned DOS OS Structure

Leave a Reply