Monday, March 27, 2023

JNTUK R20-B.Tech CSE 1-2 Python

UNIT-1           UNIT-2          UNIT-3       UNIT-4               UNIT-5


Lab Manual

Hello students, LetsLearningCse.blogspot.com welcomes you to the world of BTech. In this blog post, you are going to enhance some theoretical and technical knowledge regarding Python.

As we all know, Python is a leading high-level language that can be used for various applications.

Why Python?

  • simple and flexible

  • easy to learn.

  • less number of SLOC [source lines of code]

  • Vast libraries support machine learning, data science, deep learning, etc.

  • efficient and quality productivity

  • fast processing

Who invented Python?

On February 20, 1991, Guido van Rossum released the first version of Python.

Now Python is going up to the 3.12 version, advancing and depricating the packages every year. In this blog post, we are providing complete details regarding Python according to the JNTUK R20 syllabus. Each unit was uploaded as a separate link in this post. 

Well! Apart from that, let's discuss some stuff regarding Python. If you want a well-rounded and in-depth explanation, go through the material links. Now I am going to provide just a brief overview of Python programming.

Python is an interpreter language, which means Python executes statements statement by statement rather than executing all statements at a time.

One more thing: Python is also a dynamically typed language, which means it can understand the type of data entered into a variable.

To learn any programming language, you first need to know how to push the input and deliver the output. In Python, we provide input in two ways: instance and runtime input, and for output, we use the print() function.

for input:

instance way: a=1; b="abc"

runtime: a = input(); b = input())

for output: print (Hello world!")

for comments:

In single-line comments, we use hash (#), e.g., #print.

In multi-line comments, also known as documentation, we use a pair of three double or single quotes. """ print"""

The next step is variable assignment, and its' rules are:

Rules:

  • Variable names can start with an underscore or with an alphabet, either in lower or upper case.

  • A variable should not start with a number or special symbol.

  • A variable name should not contain a space or hyphen.

  • variable name is case-sensitive; for example, a and A were considered as two different variables.

Compared to the C language, datatype specifying is permitted for some variables only, but most of the time it understands the data dynamically.

examples: a = "abc"; b = 12;

a=input() ;b=int(input())

datatype: the type of data that is going to be stored in a variable.

Datatypes in Python are

  • Integer: int

  • Float: float

  • String: str

  • Boolean: bool

  • Complex: complex

  • container datatypes: list, tuple, set, dictionary,frozenset, numpy arrays, etc.

then coming to conditional statements, followed by indentations to differentiate the block of code.

if condition: When a condition is true, statements are executed, and when it is

if (<condition>):

#statements

along with else: when the if condition statement is false, the else block is executed.

if(<condition>):

statements

else:

statements

loops: to repeat the statements, we use loops in Python. We have two types of loops: the for loop and the while loop.

for loop syntax:

for variable_name in sequence:

                                  statements

while loop syntax:

while(<condition>):

statements

functions: it is used for the code reusability. For declaring a function, we use the def keyword.

syntax:

def <function_name>():

                       statements

function_name()

For in-depth explanation, refer to these materials.

unit wise materials: 

UNIT-1           UNIT-2          UNIT-3       UNIT-4               UNIT-5

LAB MANUAL:

Lab Manual

 

No comments: