Python Programming
Python is a powerful, versatile programming language used for web development, data analysis, AI, and more. These examples cover fundamental concepts.
print("Hello, world!")
Basic output in Python
for i in range(5):
print(i)
Simple for loop example
def add(a, b):
return a + b
Function definition
HTML Markup
HTML is the foundation of web development. These examples show essential elements for building web pages.
<!DOCTYPE html>
<html>
<head>
<title>My Page</title>
</head>
<body>
Hello World!
</body>
</html>
Basic HTML document structure
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
Heading and paragraph elements
CSS Styling
CSS makes your HTML beautiful. These examples demonstrate common styling techniques.
body {
background-color: black;
color: white;
}
Basic page styling
.btn {
background: #3b82f6;
color: white;
padding: 10px;
border-radius: 5px;
}
Button styling
JavaScript
JavaScript brings interactivity to websites. These examples show common programming patterns.
console.log("Hello from JS");
Basic console output
document.getElementById("btn").addEventListener("click", () => {
alert("Button clicked!");
});
Event handling
Java Programming
Java is a robust, object-oriented language. These examples demonstrate fundamental Java concepts.
public class Hello {
public static void main(String[] args) {
System.out.println("Hello, world!");
}
}
Classic "Hello World"
Scanner sc = new Scanner(System.in);
String name = sc.nextLine();
System.out.println("Hello " + name);
User input example