Posts

Introduction To Database Management System

  Introduction to Database Management System In engineering and computer science, DBMS (Database Management System) is one of the most important subjects. It is not only useful for exams like GATE and placement, but also essential for real-world software development. In this blog, we will cover: What is DBMS Why DBMS is needed Advantages of DBMS Application of DBMS Everything is explained in a simple and beginner-friendly way. What Is DBMS? A database-management system (DBMS) is a collection of interrelated data and a set of programs to access those data. The primary goal of a DBMS is to provide a way to store, manage and retrieve data easily. Some other operation can also be performed on database such as adding, updating and deleting data.  Instead of storing data in files, DBMS  stores data in structured format (tables). Examples of DBMS MySQL Oracle PostgreSQL SQL Server Why Do We Need DBMS? Earlier, data was stored using file systems, which caused many problems s...

Python Tuples- Immutable Date in Python

 Python Tuples - Store Data That Cannot Change Introduction In Python, we learned about lists, which allow us to store multiple values in a single variable and modify them later. But sometimes we need data that should not change during the program. For this purpose, Python provides Tuples. Tuples are similar to lists, but they are immutable, which means their values cannot be changed after creation. What Is a Tuple? A tuple is a collection of items separated by commas stored inside parentheses( ). It is immutable. Example: numbers = (10, 20, 30,40) print(numbers) Output: (10, 20, 30, 40) Tuple Can Store Different Data Types Just like lists, tuples can store different types of data Example: data =("Python", 21, 85.5, True) print(data) A tuple can store: Strings Integers Floats Boolean values Creating Tuples To create a tuple put a number of expressions, separated by commas in parentheses. You can write in the form given below:   T= ( ) T=(value,) Create a Empty Tuple The empty...

Python Lists

Image
 Python List- Store Multiple Value Easily Introduction Until now, we stored single values only using variable. But what if you want to store marks of 5 subjects? Will you create 5 variables for that. No, Instead, Python gives us something powerful: Lists . List allow us to store multiple values in a single variable. What Is a List? A list is a standard data type in python that can store a sequence of values separated by commas inside square brackets [ ]. It can store different data types. For  example: data= ["happy", 21, 85.6, True] List can store strings, integers, floats, Boolean, even other lists. List are mutable i.e., you can change the values present in the list. Creating Lists To create a list you have to put  number of expression, separated by commas inside the square brackets as depicted in the following: L=[ ] L=[values, ......] To create empty list do as follows: L=list()  #It will generate empty list and the name of the list is L. You can also create a...

Python Function

 Python Function- Write Once, Use Many Times Introduction Imagine you need to calculate the sum of two numbers many times in your programs with different values. Will you write the code again and again? No. Instead, you create a function in a program, that can have arguments, if needed can perform certain functionality can return a result What is a Function? A function is a block of code that performs a specific task. In Python we create functions using the def keyword. Basic Function Syntax def function_name(): #code Example: def calcSomething (x):     r=2* x**2     return r a= int(input("Enter a number:")) print(calcSomething(a)) 1. Where x is the argument to function calcSomething 2. return statement returns the computed result. 3. calcSomething(a) calls the function. Calling/Invoking/Using a Function To use a function that has been defined earlier, you need to write a function call statement in Python. A function call statement takes the following form: ...

Python loops (for loop & while loop)

 Python Loops(for loop & while loop) Introduction Imagine you want to print "Hello, world!" 5 times, then in Python, you will simply write print("Hello, world ") 5 times. But what if you want to print it 100 times? It's not easy, and also it waste lot of your time. So to solve this problem, loops are used. Loops help us repeat a block of code multiple times. What Is a Loop? A loop is used to execute a block of code again and again until a condition is met. Python has two main types of loops: for loop while loop The for Loop A for loop is used when we know how many times we want to repeat the code or a statement. The syntax of the code is as follows: code 1: #print numbers from 1 to 5 for i in range(1,6):     print(i) output: 1 2 3 4 5 Understanding range() range(start, stop) means: start from this number stop before the last number (stop - 1) e.g. range(1,6) will print the value from 1 to 5 code 2: #print Hello 5 times for i in range(5):     print("He...

Python Conditional Statements(if, elif, else)

Image
 Python Conditional Statements(if, elif, else)   Introduction In real life, we take decision every day like if rain then take an umbrella, if phone battery is low then charge it, etc. Similarly, in python, conditional statement are used for decision making. In this blog, you'll learn: What conditional statements are if, elif and else What Are Conditional statements? Conditional statements allow a program to perform different action based on whether a certain condition is true or false.  Suppose if we have to find the given number is divisible from 2 or not. Python mainly uses : if  elif else   Let's take above example: Code: #find numbers divisible by two and which are not. b=13 if b%2==0:     print("b is divisible by 2") else:     print("b is not divisible by 2") Output: b is not divisible by 2 The if  Statement The if statement runs code only when the condition is true. if statement can not be written without condition....

Python Input and Output(input() & print())

 Python Input and Output(input() & print()) Introduction Just like we need clear instructions in real life to complete a task, Python programs need input from users to work correctly. In Python, we take input using the input() function , and after processing that input, we display the result as output using the print() function . In this blog, you'll learn Python Input and Output with easy examples. What is Output in Python?  Output means showing something on the screen. Python uses the print() function to display output. Example: print("Hello, world!") Output: Hello, world! Printing Multiple Values You can print multiple values in one line. Code: name = "Sundeep" age = 21 Output: Sundeep 21 Print Text with Variable Code: name = "Python" print("I am learning", name) Output: I am learning Python What is Input in Python? Input means taking data from the user. Python uses the input() function to take user input. Example: name = input(...