- Python Installation Step by Step
- Variables and Data Types (with Examples & Output)
- Python – Operators and Expressions
- Control Flow Statements in Python
- Data Structures in Python – Complete Notes
- Python Objects – Step-by-Step Guide for Beginners
- File Handling in Python: Read, Write, and Manage Files
- Exception Handling in Python
- Functions in Python
- Modules in Python
- Library and Packages in Python -Introduction
- What is __init__.py in Python?
- 🧑🏫 What is Class and Object in Python? | Simple Explanation for Beginners
- What is __init__() in Python? | Constructor Made Simple
- What is self in Python? | Easy Explanation with Examples
- Encapsulation in Python | Easy OOP Explanation for Beginners
- Inheritance in Python | Learn How One Class Can Use Another
- Polymorphism in Python | One Name, Many Uses
- Method Overriding in Python | Easy Explanation with Examples
- Abstraction in Python | Hiding the Complex, Showing Only the Needed
- Difference Between Abstraction and Encapsulation in Python | Simple Words + Examples
- Most Used Libraries and Packages in Python | Easy Guide for Beginners
- How to Create Your Own Python Package (Step-by-Step Guide)
- Most Used Python Libraries (with Usage & Why Popular)
- Career-Based Python Library Guide
- NumPy Complete Reference Guide (with Real-Life Examples & Interview Q&A)
- Pandas Complete Guide (Simple English + Real-Life Examples)
- Matplotlib, Data Cleaning with Pandas, and Excel Integration using Pandas with examples and outputs.
Author: Saravana Kumar
-
Learn Python Step by Step
-
Python Installation Step by Step
1) Click to Download for Windows Operation System https://www.python.org/ftp/python/3.13.1/python-3.13.1-amd64.exe
2)Run the installer (e.g., python-3.x.x.exe).
3) On the first installation screen:
3.1) Check the box for “Use admin privileges when installing py.exe” at the bottom.
3.2) Check the box for “Add Python to PATH” at the bottom.
3.3) Click “Install Now” for default settings.

4) Wait for the installation to complete, and then click “Close”.

5)Open a Command Prompt.
5.1) In Search bar : Type CMD
5.2)Click Command Prompt
6) To Check If Python is Installed or Not
type python –version in Command Prompt
If a version number appears, Python is installed.
7) How to Use IDLE Window for to run Python Program
Interactive Mode
7.1) Type idle in Search bard
7.2) Click IDLE (python x.xx 64 bit)

7.3) When IDLE opens, you’ll see the Python shell. You can type commands directly here, and they execute immediately.
type print(“Hello World”)

Press Enter to see the output.
Script Mode
To write and save Python programs:
- Go to File → New File.
- A new editor window will open.

- Write your Python script here.

- Save the file (
Ctrl + S) with a.pyextension (e.g.,my_program.py).


To run the script:
- Click Run → Run Module (
F5).


You Can Customize Settings: In IDLE, go to Options → Configure IDLE to adjust font size, colors, and other preferences.



-
Learn Java Step by Step
- Lesson 1 : Introduction to Java Programming
- Lesson 2 : Learn to Code: Writing Your First Java Program (Hello, World!)
- Lesson 3 : Java Syntax and Structure
- Lesson 4 : Java Variables, Data Types, Primitive Types, Type Casting, and Constants: A Beginner’s Guide
- Lesson 5 : Understanding Operators in Java: A Beginner’s Guide
-
Lesson 5 : Understanding Operators in Java: A Beginner’s Guide
In Java, operators are special symbols or keywords used to perform operations on variables and values. Operators allow us to manipulate data in various ways such as performing arithmetic calculations, making comparisons, and logical operations.
Types of Operators in Java
There are several types of operators in Java, each with its own purpose. Let’s go through them one by one.
1. Arithmetic Operators
These operators are used to perform basic mathematical operations like addition, subtraction, multiplication, and division.
+(Addition): Adds two values.-(Subtraction): Subtracts one value from another.*(Multiplication): Multiplies two values./(Division): Divides one value by another.%(Modulus): Returns the remainder of a division.
Example:
int a = 10, b = 5; System.out.println(a + b); // Output: 15 System.out.println(a - b); // Output: 5 System.out.println(a * b); // Output: 50 System.out.println(a / b); // Output: 2 System.out.println(a % b); // Output: 0
2. Relational (Comparison) Operators
These operators are used to compare two values. The result is always a boolean (true or false).
==(Equal to): Checks if two values are equal.!=(Not equal to): Checks if two values are not equal.>(Greater than): Checks if the left value is greater than the right value.<(Less than): Checks if the left value is less than the right value.>=(Greater than or equal to): Checks if the left value is greater than or equal to the right value.<=(Less than or equal to): Checks if the left value is less than or equal to the right value.
Example:
int a = 10, b = 5; System.out.println(a == b); // Output: false System.out.println(a != b); // Output: true System.out.println(a > b); // Output: true System.out.println(a < b); // Output: false System.out.println(a >= b); // Output: true System.out.println(a <= b); // Output: false
3. Logical Operators
These operators are used to combine multiple boolean expressions or conditions.
&&(Logical AND): Returnstrueif both conditions are true.||(Logical OR): Returnstrueif at least one condition is true.!(Logical NOT): Reverses the boolean value (true becomes false and false becomes true).
Example:
boolean a = true, b = false; System.out.println(a && b); // Output: false System.out.println(a || b); // Output: true System.out.println(!a); // Output: false
4. Assignment Operators
These operators are used to assign values to variables.
=(Simple Assignment): Assigns the value on the right to the variable on the left.+=(Add and Assign): Adds the right value to the left variable and assigns the result to the left variable.-=(Subtract and Assign): Subtracts the right value from the left variable and assigns the result to the left variable.*=(Multiply and Assign): Multiplies the left variable by the right value and assigns the result to the left variable./=(Divide and Assign): Divides the left variable by the right value and assigns the result to the left variable.%=(Modulus and Assign): Takes the modulus of the left variable by the right value and assigns the result to the left variable.
Example:
int a = 10; a += 5; // a = a + 5 System.out.println(a); // Output: 15 a *= 2; // a = a * 2 System.out.println(a); // Output: 30
5. Unary Operators
Unary operators are used to perform operations on a single operand.
++(Increment): Increases the value of a variable by 1.--(Decrement): Decreases the value of a variable by 1.+(Unary Plus): Indicates a positive value (usually optional).-(Unary Minus): Negates the value of a variable.
Example:
int a = 5; System.out.println(++a); // Output: 6 (pre-increment) System.out.println(a--); // Output: 6 (post-decrement) System.out.println(a); // Output: 5
6. Ternary Operator
The ternary operator is a shorthand for the
if-elsestatement. It takes three operands.- Syntax:
condition ? expression1 : expression2;
If the condition is
true,expression1is executed; otherwise,expression2is executed.Example:
int a = 5, b = 10; int max = (a > b) ? a : b; System.out.println(max); // Output: 10
7. Bitwise Operators
Bitwise operators work on bits and perform bit-by-bit operations.
&(Bitwise AND): Returns 1 if both bits are 1.|(Bitwise OR): Returns 1 if at least one bit is 1.^(Bitwise XOR): Returns 1 if the bits are different.~(Bitwise NOT): Inverts all the bits.<<(Left Shift): Shifts the bits to the left.>>(Right Shift): Shifts the bits to the right.
Example:
int a = 5; // 0101 in binary int b = 3; // 0011 in binary System.out.println(a & b); // Output: 1 (0001 in binary) System.out.println(a | b); // Output: 7 (0111 in binary)
Conclusion
Operators are essential tools in programming, allowing us to perform a wide range of actions with data. From simple arithmetic to complex bitwise operations, understanding operators will help you write efficient and effective Java programs. Make sure to practice these operators to get comfortable using them in your own programs!
This article introduces the basic operators in Java and explains them in a beginner-friendly way. It’s a great start for those just learning Java or programming in general!
-
Lesson 4 : Java Variables, Data Types, Primitive Types, Type Casting, and Constants: A Beginner’s Guide
Welcome! Today we’ll explore some key concepts of Java programming that will help you write your first programs. We’ll talk about variables, data types, primitive types, type casting, and constants in a simple way.
Let’s dive in!
What is a Variable in Java?
A variable is like a box that holds a value. You can think of it as a container where you store different types of information like numbers, words, or even true/false values. Each variable has a name and a type that tells you what kind of data it can hold.
For example:
int age = 10; String name = "Alice";
In the above example:
ageis a variable that stores a number.nameis a variable that stores text.
Data Types: What Can a Variable Hold?
In Java, every variable must have a data type. The data type tells Java what kind of data the variable can store. Here are the most common types:
Primitive Data Types
Java has primitive data types, which are the most basic types of data. Let’s go over the 8 main primitive data types in Java:
- int (Integer)
- Used to store whole numbers (no decimal points).
- Example:
int age = 15;
- double (Decimal Number)
- Used to store numbers with decimal points.
- Example:
double price = 12.99;
- char (Character)
- Used to store a single character (like ‘A’, ‘B’, ‘9’).
- Example:
char grade = 'A';
- boolean (True/False)
- Used to store either
trueorfalse. - Example:
boolean isStudent = true;
- Used to store either
- byte (Small Integer)
- Used to store small integers (-128 to 127).
- Example:
byte number = 100;
- short (Medium Integer)
- Used to store medium-sized integers (-32,768 to 32,767).
- Example:
short population = 15000;
- long (Large Integer)
- Used to store large integers.
- Example:
long distance = 1000000000L;
- float (Decimal Number with less precision than
double)- Used for floating-point numbers with single precision.
- Example:
float temperature = 36.5f;
Type Casting: Changing the Type of Data
Type casting is a way to convert a variable’s value from one data type to another. For example, you can convert a double value to an int.
Types of Type Casting:
- Implicit Casting (Widening)
- Java automatically converts smaller data types to larger data types.
- Example:
int age = 10; double height = age; // Implicit casting: int to double Here, age is an integer, but Java automatically converts it to a double when stored in height
- Explicit Casting (Narrowing)
- When you convert a larger data type to a smaller one, you need to use explicit casting.
- Example:
double weight = 65.5; int roundedWeight = (int) weight; // Explicit casting: double to int Here, the decimal part of 65.5 is lost because we are converting from double to int.
Constants: Values That Don’t Change
In Java, a constant is a value that cannot be changed once it’s set. Constants are usually used for values that stay the same throughout the program, such as the number of days in a week or the value of pi.
You define constants using the
finalkeyword:final double PI = 3.14159;
Here,
PIis a constant that stores the value of π. Once set, it cannot be changed, and trying to assign a new value to it will cause an error.
Putting It All Together
Now let’s put everything we’ve learned into a small Java program that uses variables, data types, type casting, and constants:
public class Main { public static void main(String[] args) { // Declare variables int age = 15; double price = 19.99; boolean isStudent = true; // Using constants final double TAX_RATE = 0.05; // Type casting: Implicit casting double totalPrice = price + (price * TAX_RATE); // Type casting: Explicit casting int roundedPrice = (int) totalPrice; // Print the results System.out.println("Age: " + age); System.out.println("Price: $" + price); System.out.println("Is student: " + isStudent); System.out.println("Total Price with Tax: $" + totalPrice); System.out.println("Rounded Price: $" + roundedPrice); } }When you run this program, you will get the following output:
Age: 15 Price: $19.99 Is student: true Total Price with Tax: $20.9895 Rounded Price: $20
Summary:
In this article, we learned:
- Variables are used to store information.
- Data types tell us what kind of data can be stored in a variable.
- Primitive types like
int,double, andbooleanare the basic building blocks of Java. - Type casting allows you to convert between different data types.
- Constants are values that cannot change during the program’s execution.
With this knowledge, you can start writing simple Java programs and experiment with different variables, data types, and constants. Keep practicing, and soon you’ll become a Java pro!
Happy coding! 🚀
