BBA IV Sem Notes
BBA IV Sem Notes
Computer programming is the process of writing instructions, or code, that tells a computer,
application, or software program how to perform specific actions. Programmers use programming
languages to write, test, revise, and update code.
Some of the most popular programming languages include: JavaScript, HTML/CSS, SQL, Python, and
TypeScript.
Computer programmers work across industries, including: finance, insurance, manufacturing, and
tech.
• Data scientist
• Data analyst
• Project manager
• Product manager
• Data engineer
• Cybersecurity analyst
• Machine language
The lowest-level programming language, which is made up of bits and is easier for computers to
understand than programmers
A language that uses stored data to perform recursive functions. Examples include Agda, Cuneiform,
PureScript, and APL
A language that treats a program as a group of objects, each with its own properties and
methods. Examples include Java, Python, PHP, and C++
Other types of programming languages include: Assembly language, Scripting languages, and Logic
programming language.
JavaScript, Python, HTML, CSS, Java, SQL, NoSQL, C#, SCALA, and R.
What is translator ?
A translator is a computer program that converts source code into object code, which is a form that
a computer can understand and execute. Translators are also known as language processors
1. Compiler
The language processor that reads the complete source program written in high-level language as a
whole in one go and translates it into an equivalent program in machine language is called a
Compiler. Example: C, C++, C#.
In a compiler, the source code is translated to object code successfully if it is free of errors. The
compiler specifies the errors at the end of the compilation with line numbers when there are any
errors in the source code. The errors must be removed before the compiler can successfully
recompile the source code again the object program can be executed number of times without
translating it again.
2. Assembler
The Assembler is used to translate the program written in Assembly language into machine code. The
source program is an input of an assembler that contains assembly language instructions. The
output generated by the assembler is the object code or machine code understandable by the
computer. Assembler is basically the 1st interface that is able to communicate humans with the
machine. We need an assembler to fill the gap between human and machine so that they can
communicate with each other. code written in assembly language is some sort of
mnemonics(instructions) like ADD, MUL, MUX, SUB, DIV, MOV and so on. and the assembler is
basically able to convert these mnemonics in binary code. Here, these mnemonics also depend
upon the architecture of the machine.
For example, the architecture of intel 8085 and intel 8086 are different.
3. Interpreter
The translation of a single statement of the source program into machine code is done by a language
processor and executes immediately before moving on to the next line is called an interpreter. If there
is an error in the statement, the interpreter terminates its translating process at that statement and
displays an error message. The interpreter moves on to the next line for execution only after the
removal of the error. An Interpreter directly executes instructions written in a programming
or scripting language without previously converting them to an object code or machine code. An
interpreter translates one line at a time and then executes it.
• Open source: Python is free and open source, including its source code.:-
Python is open source because it's developed under an OSI-approved license that
allows it to be:
• Freely used and distributed: Python is free to use for personal or commercial purposes,
without any licensing fees.
• Publicly available: The source code for Python is open and accessible to the public.
What is IDE ?
An IDE (Integrated Development Environment) is a software application that
helps developers write, debug, and test code for Python:
Features of IDE
• Code analysis
• Graphical debugger
• Smart code editor
• Autocompletion
• Features
• Flexibility
Notebooks can be run cell by cell, and users can configure workflows to suit
their needs. They can also be converted to a number of standard output
formats, including HTML, PDF, and PowerPoint.
• Sharing
Notebooks can be shared with others using email, Dropbox, GitHub, or the
Jupyter Notebook Viewer.
• Open source
Jupyter Notebook is a fully open-source product, and users can use all of its
functionality for free.
Text Str
Type:
Mapping Dict
Type:
Boolean Bool
Type:
1.) Integer :- Int, or integer, is a whole number, positive or negative, without decimals, of
unlimited length.
2. Float:- Numbers with a decimal point or numbers written in exponential form, e.g., 3.14
3. Str:- strings are used for representing textual data. A string is a sequence of characters
enclosed in either single quotes ('') or double quotes (“”)
4. Dictionary :- built-in dictionary data type to create a Python dictionary. This type stores
all kinds of data, from integers to strings to lists. The dictionary data type is similar to a
list but uses keys instead of indexes to look up values. You use the dict() function in
Python to create a dictionary.
5 Complex:- The complex data type in python consists of two values, the first one is the
real part of the complex number, and the second one is the imaginary part of the complex
number. We usually denote the real part using i and the imaginary part with j. For example,
(3 + 7j)
6. Boolean:- The boolean data type is either True or False. In Python, boolean variables
are defined by the True and False keywords.
7. List :- List is a collection of things, enclosed in [ ] and separated by commas. The list
is a sequence data type which is used to store the collection of data.
8. Tuple:- Python tuples are a type of data structure that is very similar to lists. The main
difference between the two is that tuples are immutable, meaning they cannot be changed
once they are created.
9. Set :- Set is a data type in python used to store several items in a single variable. It is
one of the four built-in data types (List, Dictionary, Tuple, and Set) having qualities and
usage different from the other three. It is a collection that is written with curly brackets and
is both unindexed and unordered.
Python Operators
1. Arithmetic Operators
2. Comparison Operators
3. Logical Operators
4. Assignment Operators
Arithmetic operators are used with numeric values to perform common mathematical
operations:
+ Addition x+y
- Subtraction x-y
* Multiplication x*y
/ Division x/y
% Modulus x%y
** Exponentiation x ** y
= x=5 x=5
+= x += 3 x=x+3
-= x -= 3 x=x-3
*= x *= 3 x=x*3
/= x /= 3 x=x/3
%= x %= 3 x=x%3
//= x //= 3 x = x // 3
**= x **= 3 x = x ** 3
Python Comparison Operators
Comparison operators are used to compare two values:
== Equal x == y
!= Not equal x != y
and Returns True if both statements are true x < 5 and x < 10
if condition
The if condition is considered the simplest of the three and makes a decision based on
whether the condition is true or not. If the condition is true, it prints out the indented
expression. If the condition is false, it skips printing the indented expression.
if condition:
expression
if condition
if else condition
The if-else condition adds an additional step in the decision-making process compared to the
simple if statement. The beginning of an if-else statement operates similar to a simple if statement;
however, if the condition is false, instead of printing nothing, the indented expression under else will
be printed.
if (condition):
expression;
else:
expression
int age = 24
if age >= 18:
print("candidate is eligible”
else:
print("candidate is not eligible”)
if-elif-else condition
The most complex of these conditions is the if-elif-else condition. When you run into a
situation where you have several conditions, you can place as many elif conditions as
necessary between the if condition and the else condition.
if condition:
expression
elif condition:
expression
else:
expression
Example
z=3
if z % 2 == 0:
print("z is divisible by 2")
elif z % 3 == 0:
print("z is divisible by 3")
else:
print("z is neither divisible by 2 nor by 3")
Loop Control Statement
Loop Control Statements in Python
Loop control statements in python are control structures in programming that allow a
piece of code to be executed repeatedly, either a specific number of times or until a
particular condition is met
For Loop
for i in range(11):
print(i)
While Loop
num = 1
while num <= 10:
print(num)
num = num + 1
This program prints the numbers from 1 to 10 using a while loop. The loop starts at 1 and
continues until it reaches 10. The loop terminates when the value of num is greater than
10.
What is Pandas?
Pandas is a powerful and versatile library that simplifies the tasks of data manipulation
in Python. Pandas is well-suited for working with tabular data, such
as spreadsheets or SQL tables.Pandas is a Python library used for working with data
sets.
Pandas allows us to analyze big data and make conclusions based on statistical
theories.Pandas can clean messy data sets, and make them readable and relevant.
Lists can contain heterogeneous data types and objects. For instance, integers,
strings, and even functions can be stored within the same list. Different
elements of a list can be accessed by integer indices where the first element of
a list has the index of 0. This property derives from the fact that in Python, lists
are ordered, which means they retain the order in which you insert the elements
into the list.
Tuples
Tuples are almost identical to lists, so they contain an ordered collection of
elements, except for one property: they are immutable. We would use tuples
if we needed a data structure that, once created, cannot be modified anymore
Dictionaries
Sets
Sets contain unique elements, so no duplicates are allowed. Thus, sets can
be used to remove duplicates from a list.
Mutability:
Order:
For example, if we have a list of integers and want to create a new list containing the
square of each element, we can easily achieve this using list comprehension.
a = [2,3,4,5]
print(res)
What is NumPy
NumPy stands for numeric python which is a python package for the computation and
processing of the multidimensional and single dimensional array elements.
What is function ?
import pandas as pd
res1 = pd.concat(frames)
res1