Topic :Software & Types, Subject: Computer Fundamental Notes for CSJM University Kanpur(for different courses like BBA, BCA, etc..)


Software

Software refers to the programs, data, and instructions that enable a computer or other digital device to perform specific tasks or functions. It is the non-tangible part of a computer system that allows hardware to execute various operations. Software can be categorized into several types based on its functionality and purpose. Here are some common types of software:

Types of software

  1. System Software:

Operating Systems (OS): These are the fundamental software that manages hardware resources, provides user interfaces, and enables communication between hardware and other software applications. Examples include Windows, macOS, Linux, and Android.

Device Drivers: These software components allow the operating system to communicate with and control various hardware devices such as printers, graphics cards, and peripherals.

  1. Application Software:

Word Processing Software: Used for creating, editing, and formatting text documents. Examples include Microsoft Word, Google Docs, and LibreOffice Writer.

Spreadsheet Software: Designed for creating and managing spreadsheets and performing calculations. Examples include Microsoft Excel and Google Sheets.

Presentation Software: Used for creating slideshows and presentations. Examples include Microsoft PowerPoint and Google Slides.

Database Software: Helps users manage and manipulate data in structured databases. Examples include Microsoft Access and MySQL.

Graphics and Design Software: Used for graphic design, image editing, and digital art creation. Examples include Adobe Photoshop and Illustrator.

Web Browsers: Enable users to access and interact with websites on the internet. Examples include Google Chrome, Mozilla Firefox, and Microsoft Edge.

Email Clients: Used for sending, receiving, and managing email messages. Examples include Microsoft Outlook and Mozilla Thunderbird.

Media Players: Play audio and video files. Examples include VLC Media Player and Windows Media Player.

  1. Utility Software:

Antivirus Software: Protects the computer from viruses, malware, and other security threats. Examples include Norton, McAfee, and Avast.

Backup Software: Helps in creating backups of important data and restoring it when needed. Examples include Acronis True Image and Time Machine (for macOS).

File Compression Software: Reduces the size of files and folders to save storage space. Examples include WinZip and 7-Zip.

Disk Cleanup and Optimization Tools: Maintain and optimize the performance of storage devices. Examples include CCleaner and Disk Defragmenter (built into Windows).

  1. Development Software:

Integrated Development Environments (IDEs): Provide tools for software developers to write, test, and debug code. Examples include Visual Studio and Eclipse.

Compilers and Interpreters: Translate programming code into machine-readable instructions. Examples include GCC (compiler) and Python (interpreter).

  1. Educational Software:

Educational Games: Designed for learning purposes, often used in schools and for self-study. Examples include educational apps for math, science, and language learning.

  1. Entertainment Software:

Video Games: Designed for entertainment and gaming experiences. Examples include Fortnite, Minecraft, and Call of Duty.

  1. Business Software:

Enterprise Resource Planning (ERP) Software: Helps businesses manage various processes like finance, HR, and inventory. Examples include SAP and Oracle.

Customer Relationship Management (CRM) Software: Helps businesses manage customer interactions and data. Examples include Salesforce and HubSpot.

  1. Communication Software:

Instant Messaging (IM) and Chat Applications: Facilitate real-time text and multimedia communication. Examples include WhatsApp, Slack, and Skype.

Voice over IP (VoIP) Software: Allows voice and video calls over the internet. Examples include Zoom and Skype for Business.

These are some of the broad categories of software, and there are many subcategories and specialized software tools within each. The type of software you use depends on your needs and the tasks you want to accomplish with your computer or device.


Best free Application for Students for asking doubts

Free Application for Student Join fast with this link 

Have you tried asking your doubts ? If not, go ahead and start doing it right away. 
You get instant solution for all your study related questions from real and live teachers within minutes. A number of good teachers along with myself are spending time teaching thousands of students. 

Download the app NOW - https://app.findfilo.com/download/gmrh

Python Programming Notes and Practical Programs BCA 3rd Semester CSJM University Kanpur (Lecture 7) Topic- Recursion

 

Python Programming Notes and Practical Programs BCA 3rd Semester CSJM University Kanpur

 

Python Recursion

function is said to be a recursive if it calls itself. For example, lets say we have a function abc() and in the body of abc() there is a call to the abc().

Python example of Recursion

In this example we are defining a user-defined function factorial(). This function finds the factorial of a number by calling itself repeatedly until the base case(We will discuss more about base case later, after this example) is reached.

# Example of recursion in Python to

# find the factorial of a given number

 

def factorial(num):

    """This function calls itself to find

    the factorial of a number"""

 

    if num == 1:

        return 1

    else:

        return (num * factorial(num - 1))

 

 

num = 5

print("Factorial of", num, "is: ", factorial(num))

Output:

Factorial of 5 is:  120

Lets see what happens in the above example:

factorial(5) returns 5 * factorial(5-1)

    i.e. 5 * factorial(4)

               |__5*4*factorial(3)

                      |__5*4*3*factorial(2)

                           |__5*4*3*2*factorial(1)

Note: factorial(1) is a base case for which we already know the value of factorial. The base case is defined in the body of function with this code:

if num == 1:

    return 1

What is a base case in recursion

When working with recursion, we should define a base case for which we already know the answer. In the above example we are finding factorial of an integer number and we already know that the factorial of 1 is 1 so this is our base case.

Each successive recursive call to the function should bring it closer to the base case, which is exactly what we are doing in above example.

We use base case in recursive function so that the function stops calling itself when the base case is reached. Without the base case, the function would keep calling itself indefinitely.

Why use recursion in programming?

We use recursion to break a big problem in small problems and those small problems into further smaller problems and so on. At the end the solutions of all the smaller subproblems are collectively helps in finding the solution of the big main problem.

Advantages of recursion

Recursion makes our program:
1. Easier to write.
2. Readable – Code is easier to read and understand.
3. Reduce the lines of code – It takes less lines of code to solve a problem using recursion.

Disadvantages of recursion

1. Not all problems can be solved using recursion.
2. If you don’t define the base case then the code would run indefinitely.
3. Debugging is difficult in recursive functions as the function is calling itself in a
loop and it is hard to understand which call is causing the issue.
4. Memory overhead – Call to the recursive function is not memory efficient.

Python Programming Notes and Practical Programs BCA 3rd Semester CSJM University Kanpur (Lecture 6) Topic- Functions

Python Programming Notes and Practical Programs BCA 3rd Semester CSJM University Kanpur

 

Python Functions

A function is a block of code that contains one or more Python statements and used for performing a specific task.

Why use function in Python?

what we can achieve in Python by using functions in our code:
1. Code re-usability: Lets say we are writing an application in Python where we need to perform a specific task in several places of our code, assume that we need to write 10 lines of code to do that specific task. It would be better to write those 10 lines of code in a function and just call the function wherever needed, because writing those 10 lines every time you perform that task is tedious, it would make your code lengthy, less-readable and increase the chances of human errors.

2. Improves Readability: By using functions for frequent tasks you make your code structured and readable. It would be easier for anyone to look at the code and be able to understand the flow and purpose of the code.

3. Avoid redundancy: When you no longer repeat the same lines of code throughout the code and use functions in places of those, you actually avoiding the redundancy that you may have created by not using functions.

Syntax of functions in Python

Function declaration:

def function_name(function_parameters):

               function_body # Set of Python statements

        return # optional return statement

Calling the function:

# when function doesn't return anything

function_name(parameters)

OR

# when function returns something

# variable is to store the returned value

variable = function_name(parameters)

 

Python Function example

Here we have a function add() that adds two numbers passed to it as parameters. Later after function declaration we are calling the function twice in our program to perform the addition.

def add(num1, num2):

    return num1 + num2

 

 

sum1 = add(100, 200)

sum2 = add(8, 9)

print(sum1)

print(sum2)

Output:

300

17

 

Default arguments in Function

Now that we know how to declare and call a function, lets see how can we use the default arguments. By using default arguments we can avoid the errors that may arise while calling a function without passing all the parameters. Lets take an example to understand this:

In this example we have provided the default argument for the second parameter, this default argument would be used when we do not provide the second parameter while calling this function.

# default argument for second parameter

def add(num1, num2=1):

    return num1 + num2

 

 

sum1 = add(100, 200)

sum2 = add(8)  # used default argument for second param

sum3 = add(100)  # used default argument for second param

print(sum1)

print(sum2)

print(sum3)

Output:

300

9

101

 

Types of functions

There are two types of functions in Python:
1. Built-in functions: These functions are predefined in Python and we need not to declare these functions before calling them. We can freely invoke them as and when needed.
2. User defined functions: The functions which we create in our code are user-defined functions. The add() function that we have created in above examples is a user-defined function.

Python Programming Notes and Practical Programs BCA 3rd Semester CSJM University Kanpur (Lecture 5) Topic- If-else

Python Programming Notes and Practical Programs BCA 3rd Semester CSJM University Kanpur

Python If Statement explained with examples

If statements are control flow statements which helps us to run a particular code only when a certain condition is satisfied. For example, you want to print a message on the screen only when a condition is true then you can use if statement to accomplish this in programming. In this guide, we will learn how to use if statements in Python programming with the help of examples.

There are other control flow statements available in Python such as if..else, if..elif..else,
nested if etc. However in this guide, we will only cover the if statements, other control statements are covered in this
.

Syntax of If statement in Python

The syntax of if statement in Python is pretty simple.

if condition:
   block_of_code

If statement flow diagram




Python – If statement Example

flag = True
if flag==True:
    print("Welcome")
    print("To")
    print("csaankitblogspot.com")

Output:

Welcome
To
csaankitblogspot.com

In the above example we are checking the value of flag variable and if the value is True then we are executing few print statements. The important point to note here is that even if we do not compare the value of flag with the ‘True’ and simply put ‘flag’ in place of condition, the code would run just fine so the better way to write the above code would be:

flag = True
if flag:
    print("Welcome")
    print("To")
    print("csaankitblogspot.com")

By seeing this we can understand how if statement works. The output of the condition would either be true or false. If the outcome of condition is true then the statements inside body of ‘if’ executes, however if the outcome of condition is false then the statements inside ‘if’ are skipped. Lets take another example to understand this:

flag = False
if flag:
    print("You Guys")
    print("are")
    print("Awesome")

The output of this code is none, it does not print anything because the outcome of condition is ‘false’.

Python if example without boolean variables

In the above examples, we have used the boolean variables in place of conditions. However we can use any variables in our conditions. For example:

num = 100
if num < 200:
    print("num is less than 200")

Output:

num is less than 200
num = 10

1. The name of the variable must always start with either a letter or an underscore (_). For example: _str, str, num, _num are all valid name for the variables.
2. The name of the variable cannot start with a number. For example: 9num is not a valid variable name.
3. The name of the variable cannot have special characters such as %, $, # etc, they can only have alphanumeric characters and underscore (A to Z, a to z, 0-9 or _).
4. Variable name is case sensitive in Python which means num and NUM are two different variables in python.

Python identifier example

In the following example we have three variables. The name of the variables num_x and a_b are the identifiers.

# few examples of identifiers
 
num = 10
print(num)
 
_x = 100
print(_x)
 
a_b = 99
print(a_b)

Output:
10

100

99

 

Python If else Statement Example

In the last tutorial we learned how to use if statements in Python. In this guide, we will learn another control statement ‘if..else’.

We use if statements when we need to execute a certain block of Python code when a particular condition is true. If..else statements are like extension of ‘if’ statements, with the help of if..else we can execute certain statements if condition is true and a different set of statements if condition is false. For example, you want to print ‘even number’ if the number is even and ‘odd number’ if the number is not even, we can accomplish this with the help of if..else statement.

Python – Syntax of if..else statement

if condition:
   block_of_code_1
else:
   block_of_code_2

block_of_code_1: This would execute if the given condition is true
block_of_code_2: This would execute if the given condition is false

If..else flow control


 

If-else example in Python

num = 22
if num % 2 == 0:
    print("Even Number")
else:
    print("Odd Number")

Output:

Even Number
 

 

Python If elif else statement example

In the previous tutorials we have seen if statement and if..else statement. In this tutorial, we will learn if elif else statement in Python. The if..elif..else statement is used when we need to check multiple conditions.

Syntax of if elif else statement in Python

This way we are checking multiple conditions.

if condition:
   block_of_code_1
elif condition_2:
   block_of_code_2
elif condition_3:
   block_of_code_3
..
..
..
else:
  block_of_code_n

Notes:
1. There can be multiple ‘elif’ blocks, however there is only ‘else’ block is allowed.
2. Out of all these blocks only one block_of_code gets executed. If the condition is true then the code inside ‘if’ gets executed, if condition is false then the next condition(associated with elif) is evaluated and so on. If none of the conditions is true then the code inside ‘else’ gets executed.

 

Python – if..elif..else statement example

In this example, we are checking multiple conditions using if..elif..else statement.

num = 1122
if 9 < num < 99:
    print("Two digit number")
elif 99 < num < 999:
    print("Three digit number")
elif 999 < num < 9999:
    print("Four digit number")
else:
    print("number is <= 9 or >= 9999")

Output:

 

Python Nested If else statement

In the previous tutorials, we have covered the if statementif..else statement and if..elif..else statement. In this tutorial, we will learn the nesting of these control statements.

When there is an if statement (or if..else or if..elif..else) is present inside another if statement (or if..else or if..elif..else) then this is calling the nesting of control statements.

Nested if..else statement example

Here we have a if statement inside another if..else statement block. Nesting control statements makes us to check multiple conditions.

num = -99
if num > 0:
    print("Positive Number")
else:
    print("Negative Number")
    #nested if
    if -99<=num:
        print("Two digit Negative Number")

Output:

Negative Number
Two digit Negative Number

 

Python for Loop explained with examples

A loop is a used for iterating over a set of statements repeatedly. In Python we have three types of loops forwhile and do-while. In this guide, we will learn for loop and the other two loops are covered in the separate tutorials.

Syntax of For loop in Python

for <variable> in <sequence>:  
   # body_of_loop that has set of statements
   # which requires repeated execution

Here <variable> is a variable that is used for iterating over a <sequence>. On every iteration it takes the next value from <sequence>  until the end of sequence is reached.

Lets take few examples of for loop to understand the usage.

Python – For loop example

The following example shows the use of for loop to iterate over a list of numbers. In the body of for loop we are calculating the square of each number present in list and displaying the same.

# Program to print squares of all numbers present in a list
 
# List of integer numbers
numbers = [1, 2, 4, 6, 11, 20]
 
# variable to store the square of each num temporary
sq = 0
 
# iterating over the given list
for val in numbers:
    # calculating square of each number
    sq = val * val
    # displaying the squares
    print(sq)

Output:

1
4
16
36
121
400

 

Function range()

In the above example, we have iterated over a list using for loop. However we can also use a range() function in for loop to iterate over numbers defined by range().

range(n): generates a set of whole numbers starting from 0 to (n-1).
For example:
range(8) is equivalent to [0, 1, 2, 3, 4, 5, 6, 7]

range(start, stop): generates a set of whole numbers starting from start to stop-1.
For example:
range(5, 9) is equivalent to [5, 6, 7, 8]

range(start, stop, step_size): The default step_size is 1 which is why when we didn’t specify the step_size, the numbers generated are having difference of 1. However by specifying step_size we can generate numbers having the difference of step_size.
For example:
range(1, 10, 2) is equivalent to [1, 3, 5, 7, 9]

Lets use the range() function in for loop:

Python for loop example using range() function

Here we are using range() function to calculate and display the sum of first 5 natural numbers.

# Program to print the sum of first 5 natural numbers
 
# variable to store the sum
sum = 0
 
# iterating over natural numbers using range()
for val in range(1, 6):
    # calculating sum
    sum = sum + val
 
# displaying sum of first 5 natural numbers
print(sum)

Output:

15

For loop with else block

Unlike Java, In Python we can have an optional ‘else’ block associated with the loop. The ‘else’ block executes only when the loop has completed all the iterations. Lets take an example:

for val in range(5):
               print(val)
else:
               print("The loop has completed execution")

Output:

0
1
2
3
4
The loop has completed execution

Note: The else block only executes when the loop is finished.

Nested For loop in Python

When a for loop is present inside another for loop then it is called a nested for loop. Lets take an example of nested for loop.

for num1 in range(3):
               for num2 in range(10, 14):
                               print(num1, ",", num2)

Output:

0 , 10
0 , 11
0 , 12
0 , 13
1 , 10
1 , 11
1 , 12
1 , 13
2 , 10
2 , 11
2 , 12
2 , 13

 

Python While Loop

While loop is used to iterate over a block of code repeatedly until a given condition returns false. In the last tutorial, we have seen for loop in Python, which is also used for the same purpose. The main difference is that we use while loop when we are not certain of the number of times the loop requires execution, on the other hand when we exactly know how many times we need to run the loop, we use for loop.

Syntax of while loop

while condition:
    #body_of_while

The body_of_while is set of Python statements which requires repeated execution. These set of statements execute repeatedly until the given condition returns false.

Flow of while loop

1. First the given condition is checked, if the condition returns false, the loop is terminated and the control jumps to the next statement in the program after the loop.
2. If the condition returns true, the set of statements inside loop are executed and then the control jumps to the beginning of the loop for next iteration.

These two steps happen repeatedly as long as the condition specified in while loop remains true.

 

Python – While loop example

Here is an example of while loop. In this example, we have a variable num and we are displaying the value of num in a loop, the loop has a increment operation where we are increasing the value of num. This is very important step, the while loop must have a increment or decrement operation, else the loop will run indefinitely, we will cover this later in infinite while loop.

num = 1
# loop will repeat itself as long as
# num < 10 remains true
while num < 10:
    print(num)
    #incrementing the value of num
    num = num + 3

Output:

1
4
7

 

Infinite while loop

Example 1:
This will print the word ‘hello’ indefinitely because the condition will always be true.

while True:
   print("hello")

Example 2:

num = 1
while num<5:
   print(num)

This will print ‘1’ indefinitely because inside loop we are not updating the value of num, so the value of num will always remain 1 and the condition num < 5 will always return true.

Nested while loop in Python

When a while loop is present inside another while loop then it is called nested while loop. Lets take an example to understand this concept.

i = 1
j = 5
while i < 4:
    while j < 8:
        print(i, ",", j)
        j = j + 1
        i = i + 1

Output:

1 , 5
2 , 6
3 , 7

 

Python – while loop with else block

We can have a ‘else’ block associated with while loop. The ‘else’ block is optional. It executes only after the loop finished execution.

num = 10
while num > 6:
   print(num)
   num = num-1
else:
   print("loop is finished")

Output:

10
9
8
7
loop is finished

 

Python break Statement

The break statement is used to terminate the loop when a certain condition is met. We already learned in previous tutorials (for loop and while loop) that a loop is used to iterate a set of statements repeatedly as long as the loop condition returns true. The break statement is generally used inside a loop along with a if statement so that when a particular condition (defined in if statement) returns true, the break statement is encountered and the loop terminates.

For example, lets say we are searching an element in a list, so for that we are running a loop starting from the first element of the list to the last element of the list. Using break statement, we can terminate the loop as soon as the element is found because why run the loop unnecessary till the end of list when our element is found. We can achieve this with the help of break statement (we will see this example programmatically in the example section below).

Syntax of break statement in Python

The syntax of break statement in Python is similar to what we have seen in Java.

break            

Flow diagram of break


 

 

Example of break statement

In this example, we are searching a number ’88’ in the given list of numbers. The requirement is to display all the numbers till the number ’88’ is found and when it is found, terminate the loop and do not display the rest of the numbers.

# program to display all the elements before number 88
for num in [11, 9, 88, 10, 90, 3, 19]:
   print(num)
   if(num==88):
                  print("The number 88 is found")
                  print("Terminating the loop")
                  break

Output:

11
9
88
The number 88 is found
Terminating the loop

Note: You would always want to use the break statement with a if statement so that only when the condition associated with ‘if’ is true then only break is encountered. If you do not use it with ‘if’ statement then the break statement would be encountered in the first iteration of loop and the loop would always terminate on the first iteration.

Python Continue Statement

The continue statement is used inside a loop to skip the rest of the statements in the body of loop for the current iteration and jump to the beginning of the loop for next iteration. The break and continue statements are used to alter the flow of loop, break terminates the loop when a condition is met and continue skip the current iteration.

Syntax of continue statement in Python

The syntax of continue statement in Python is similar to what we have seen in Java(except the semicolon)

continue

Flow diagram of continue



Example of continue statement

Lets say we have a list of numbers and we want to print only the odd numbers out of that list. We can do this by using continue statement.
We are skipping the print statement inside loop by using continue statement when the number is even, this way all the even numbers are skipped and the print statement executed for all the odd numbers.

# program to display only odd numbers
for num in [20, 11, 9, 66, 4, 89, 44]:
    # Skipping the iteration when number is even
    if num%2 == 0:
        continue
    # This statement will be skipped for all even numbers
    print(num)

Output:

11
9
89

 

Python pass Statement

The pass statement acts as a placeholder and usually used when there is no need of code but a statement is still required to make a code syntactically correct. For example we want to declare a function in our code but we want to implement that function in future, which means we are not yet ready to write the body of the function. In this case we cannot leave the body of function empty as this would raise error because it is syntactically incorrect, in such cases we can use pass statement which does nothing but makes the code syntactically correct.

Pass statement vs comment

You may be wondering that a python comment works similar to the pass statement as it does nothing so we can use comment in place of pass statement. Well, it is not the case, a comment is not a placeholder and it is completely ignored by the Python interpreter while on the other hand pass is not ignored by interpreter, it says the interpreter to do nothing.

Python pass statement example

If the number is even we are doing nothing and if it is odd then we are displaying the number.

for num in [20, 11, 9, 66, 4, 89, 44]:
    if num%2 == 0:
        pass
    else:
        print(num)

Output:

11
9
89

Other examples:

A function that does nothing(yet), may be implemented in future.

def f(arg): pass    # a function that does nothing (yet)

A class that does not have any methods(yet), may have methods in future implementation.

class C: pass       # a class with no methods (yet)

Topic :Software & Types, Subject: Computer Fundamental Notes for CSJM University Kanpur(for different courses like BBA, BCA, etc..)

Software Software refers to the programs, data, and instructions that enable a computer or other digital device to perform specific tasks or...