top of page
hand-businesswoman-touching-hand-artificial-intelligence-meaning-technology-connection-go-

Python Introduction

History Of Python-

· The Python is the programming language, and the name isn’t after any snake or anything, but the name is after a British comedy troupe Monty Python So this guy Guido Van Rossum in the early 90s he was watching this British comedy show And that’s the time he invented python and that’s why he named it So and it was invented in Netherlands.

People say it is very easy. Google started using it from the beginning and that made it very popular and since the beginning of the inception of this language it has been used in, a widely used everywhere.

· It is it is open-sourced Means that the codes in the python anybody can inspect it, modify it, enhance it.

· It’s Considered a scripting language that means short scripts are used for the codes rather than big full computer programs so this is just a brief history of python.


Next look at a few features


Features Of Python-

1. Easy to Learn- It has a few keywords; simple structure and it has a clearly defined syntax. So, because of this user find it easy to use compared to other programming languages.


2. Rich Standard Library Set- It has a very rich library set because of which it can be applied at a lot of places.


3. Open Source- It is open source that means you can run it on any you know Windows Mac platform independent and


4. Platform Independent and Portable- It is portable so you can run it on multiple hardware platforms, and it is the same interface on all the platforms like power BI wasn’t able to run on Mac. But Python is independent of everything, and it runs everywhere. The best part of this is it’s free. That’s the good advantage of python.


5. Dynamically typed- It is dynamically typed, which means that the type of the value that we use the data type. We don’t have to define it pre hand but during the runtime it is decided by the system itself, What kind of data type it is. So, there is no need to declare the data type beforehand like we do in SQL.


6. Interpreted Language- it is interpreted language. So interpreted means that it converts the source code into something that is called as intermediate form called the byte code and from the byte code it turns into the mission code. So, it is an interpreted language, and it converts one statement of a program at one time.


Data Types in Python-

So, there are four main data types

1. Number.

2. Boolean.

3. String.

4. Collection.

So number is further subcategorized into- Integer, float and complex.

and collection is further subcategorized into- list, tuple, set and dictionary.

1. Integer- Int is what it is just a simple number It’s a whole number It can be either positive or it can be negative and there is no decimal point. The default value of INT is 0.

2. Float- Float is a short form for floating point real values. They are real numbers that means they have a decimal point in them. A decimal point divides it into the integer part and the fractional part. Any number that you see with a decimal, that data type is called float.

3. Complex numbers- The form for the complexes a + b j wherever you see this letter j that means it is a complex number, but a good indication for a complex number is, that it will have a j in its format.

4. Boolean- Boolean means that the values are of two kinds either the answer is going to be true or false. Booleans means true and false, and the default value is always takes False.

5. String- so string is nothing but it’s a collection of characters and this is the most popular type that is used in python. how do you identify it as a string It will be always enclosed in Quotes. It doesn’t matter Its single quotes or double quotes, but it Is always enclosed in quotes. whenever you see a quote, you know that it is a string data type.

6. List- list is comes under the connection. it is a collection of various data types. It is the versatile data type that is used in python and all the values are separated by commas.

List1= [‘python’, ’math’, 2000, 2004]

List2= [1,2,3,4,5]

List3= [‘hello’, ’world’, ’learn’, ’python’]

Like string indices, List Indices starts at 0.

7. Tuple- Tuple is a sequence of immutable python objects. The difference between Tuple and list is tuple has the round brackets. Whereas list had square brackets.

8. Dictionary- It has the curly braces and there is the key is separated from the value using the colon(:).

9. Set- set is also immutable collection of unordered and unique items. Set has unique items and this is also in the Curly Braces.

List it is created using square brackets. Each item is separated by Comma (,). List is mutable, means that you can either add items, delete items, update items.

Tuple is in the round brackets and the items are separated by Comma (,) like tomato, potato, onion, radish. Tuple once you have defined it, you cannot change. It is immutable and the processing is faster than list.

Dictionary is unordered changeable and indexed. Unordered means It can be in any sequence and it is in Curly braces. Name is the key and Ramesh is the value. So, key and value are separated by a colon And then age is the key 30 is the value separated by: And these two are separated by a comma. Key value pairs are separated by (,) so that is dictionary.

Set is also immutable collection of unordered and unique items. Set has unique items and this is also in the Curly Braces.

So just trying to put it in this table because it gets confusing.


OK next we come to the operators.


Operators-

1. Assignment operator- Assignment operator means that we are assigning the value to something. We are assigning a value of right operand to the left operand. Various assignment operators used in python are (+, +=, -=, *=, /=).

2. Relational operators- Relational operators are used to establish a relationship between two operands. Various relational operators used in python are (>, <, >=, <=, ==, !=).

3. Logical operator- Logical operator means they are used in the logical expressions Like if this condition is true and this condition is true then it will turn true or false; So this is the Boolean values that will give true or false. Both the conditions are true and if only one condition needs to be true Or is used. Various Logical operators used in python are And (&), Or (||), Not (~).

4. Arithmetic operator- These are used to perform all the mathematical operations addition, subtraction, multiplication, division.

5. Membership operator- (IN, NOT IN). These are used to test whether a value or variable is found in a sequence or not. If it is found, then IN. NOT IN that means not found. So, this one will be used.

6. Identity operator- (IS and IS NOT). They are used to check if two values or variables are located on same part of the memory. if the memory location of two variables is the same then it is identity operator. same location of memory they are present. If they are not, then it will not be identical. So, two variables that are equal to not imply that they are identical.

Naming conventions-

-whenever we want to name a variable just main thing, we must remember is that.

-It can either start with an alphabet or it can start with an (_) Underscore.

-It cannot start with a number and python is Case sensitive, so we have to make sure what a case we are using because if we just change the case then we get a wrong answer.

-There should be no space when we are naming It should always be wherever you want to put a space just put (_) underscore.

-Reserved keywords should not be used as names for variables.

Reserved keywords-

False, None, true, _peg _parser _, and, as, assert, async, await, break, class, continue, def, del, elif, else, except, finally, for, from, global, if, import, in, is, lambda, nonlocal, not, or, pass, raise, return, try, while, with, yield


1. General

-Names are case sensitive and cannot start with a number.

-Good: user_profile, menu_options, word _ definitions.

-When using camel case names, capitalize all letters of an abbreviations example HTTPserver.


2. Variables

-Variable names should be all lowercase

-Words in a variable name should be separated by an Underscore.

-If an instance name needs to be mangled, two underscores may begin its name.


3. Classes

-Class names should follow the upper-case camel case convention.

-Pythons built in classes however are typically lower-case words.

-Exception classes should end in error.


4. Method

-Method names should be all lower case.

-words in a method name should be separated by an underscore.

-nonpublic methods should begin with a single underscore.

-If a method name needs to be mangled two underscores may begin its name


5. Method arguments

-Instance methods should have their first argument named ‘self.’

-Class methods should have their first argument named ‘cls’


6. Functions

-Function names should be all lowercase.

-Words in a function name should be separated by an underscore.


7. Constants

-Constant names must be fully capitalized.

-Words in a constant name should be separated by an underscore.


Variables-

variable name the name of the memory location is called variable. And variable is used to store the data

we are saying X= 5.

What is X over here X is the variable and 5 is the value that we are giving to the variable. We are assigning the value 5 to the variable and we will be using ‘=’ sign to tell that X is within the value of five. For assignment operator left side is always a variable and right side is always the value.


58 views0 comments

Recent Posts

See All

Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating
bottom of page