Showing posts with label 1-2 SEMESTER. Show all posts
Showing posts with label 1-2 SEMESTER. Show all posts

Thursday, November 2, 2023

UNIT - 2 [PYTHON]

  UNIT-2 

We are committed to providing thorough Python resources that are especially suited to the JNTUK University R2O program. We will explore control statements in this blog post, going over topics like text output, loop formatting, and definite iteration. We will also look at conditional iteration with the while loop and selection statements, such as if and if-else statements.
Any computer language must include strings and text files, and Python is no different. We will go over data encryption methods and how to access characters and substrings within strings. In addition, we will discuss string and number systems and offer important insights into how they work. Finally, we will investigate the wide variety of string operations that Python offers and look at the nuances involved with handling text files.
Our goal at LetsLearningCse is to make learning Python entertaining and educational. We take great care in selecting our materials so that they correspond with the JNTUK University R2O syllabus and give students a thorough comprehension of the material. As we continue to assist you in your educational path, stay tuned for more interesting articles about Python.empowering students, one Python idea at a time using LetsLearningCse.

What are we going to gain from this material?

  • Control statements: control statements are the program statements that allow the computer to select a part of the code or repeat an action to specify it. They are categorized into selection statements, iterative statements, looping statements, and jump statements.
  • iterative statements: this was classified into mainly 2 categories.There are definite iterations and indefinite iterations.
  • Definite Iteration: for a loop, it is a definite iteration; it iterates until the sequence exists.
  •  conditional iteration: the A loop that requires a condition to be tested within the loop to determine whether the loop should continue is called the loop's continuation condition. If the continuation condition is false, the loop ends. If the continuation condition is true, the statements within the loop are executed again.
  • While loop: it is a conditional iteration statement and is frequently used to execute a block of statements repeatedly until some condition remains true. 
  • Formatting text for output: the total number of data characters and additional spaces for a given data in a formatted string is called its field width. The formatting output, rather than simply printing space-separated values, can be done in three ways: Formatting output using the string modulo operator (%) formatting output using the format method f-literal in Python
  • strings: a string is a sequence of characters enclosed in single or double quotation marks. It is a data structure. A data structure is a compound unit that consists of several smaller pieces of data. The string is an immutable data structure.
  • Data Encryption: Data encryption is used to protect information transmitted on networks. Data encryption is a security method where information is encoded and can only be accessed or decrypted by a user with the correct encryption key
  •  Number Systems: When you perform arithmetic operations, you use the decimal number system. A binary number system is used to represent all information on a digital computer.
  • Text files: all files must be opened first before they can be read from or written to using Python's built-in open() function. write(): This method is used to write the contents of a string to the file. read(): This method is used to read the contents of a file. remove(): to delete a file
 Link to the material:    UNIT-2
 

UNIT -1 [PYTHON]

 UNIT-1 

Greetings from LetsLearningCse.blogspot.com. This blog article will help you learn more about Python.

Note: This material is provided based on the JNTUK R20 syllabus.

Let's dive into the content you are all going to see in this material. In this, you can see what Python is and what a program development cycle is, and along with that, you are going to see what the datatypes, structures, precendence, etc.

Python is a high-level language that is flexible enough to deal with vast areas of work such as data science, machine learning, robotics, and AI assistant creation.

Why do most people prefer the Python language?

People prefer the Python language mostly for several reasons:

  • simple and easy to learn.
  • flexibility
  • free and open source
  • vast standard libraries
  • scalability
  • less SLOC [source lines of code]
  • dynamically typed and interpreted language
  • efficient data visualization after R-language
  • Object-oriented programming and integrated
  • GUI support
  • cross-platform language/portability

Python was invented by Guido Van Rossum in 1991. In fact, so many people don't know why Python is named Python. There is a fact: when Guido van Rossum reads a famous BBC comic about Monty Python flying circus, he wanted to choose a name a little bit mysterious, so he chose Python as the name of his invention.

You can download Python from the www.python.org site. There are a vast number of platforms for Python, such as Idle 3.12, Notepad, Notepad++, Spyder, Jupyter Notebook, Pycharm, Sublime Editor, Anaconda, Visual Studio, etc.

Why should we learn Python? Python can help in various fields such as web development, machine learning, data analysis, scripting, game development, embedded applications for IOT, data science, deep learning, and natural language processing.

What do you gain from this material about Python?

  • Input: how we provide the input in Python, such as static input and dynamic input.
  • Processing: how is the input data processed in Python, and what are the stages involved in the processing of Python code?
  • Output: how the output is displayed in the shell of a Python script
  • Output with the print Function: The print function is an output function that returns the output data in the Python shell.
  • Comments: Comments are necessary to learn how to provide a description of how the code works. In Python, we have single-line comments and multiline comments, also known as documentation.
  • Variables: These are the containers that store data using a specific name. Here you'll see what the rules are for declaring a perfect variable and how we can manipulate a variable.
  • Reading input from the keyboard: input() is a function to read the input from the user side into the program.
  • Performing Calculations: How You Can Do Calculations Using Python will be seen.
  • operators: what are the operators to perform the various calculations using Python, such as arithemetic, logical, and shift operations?
  • conditional statements: they are used in decision-making using Python and are completed based on boolean values.
  • if condition: if the given condition is true, then only code in its block is executed.
  • if-else condition: the given condition is true. if block is executed; otherwise, block is executed.
  • Repetition structures: in this, it shows how code can be repeated multiple times.
  • While loop: until the condition is false, the loop is executed.
  • for loop: until the sequence exists, statements are executed.

 link to the material: UNIT-1

 

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