Coding Basics Notes for Beginners
What is Coding?
Coding is giving instructions to a computer using a programming language.
Example:
print("Hello, world!")
Variables
Used to store data.
Example:
name = "Sakinthan"
age = 20
Data Types
String: "hello"
Integer: 5
Float: 3.14
Boolean: True or False
Operators
Used for calculations:
a=5+3
b=6*2
c = 10 / 2
Input and Output
Take input from the user and print output:
name = input("Enter your name: ")
print("Hello", name)
Coding Basics Notes for Beginners
If-Else Conditions
age = 18
if age >= 18:
print("You are an adult")
else:
print("You are a minor")
Loops
While loop:
count = 1
while count <= 5:
print(count)
count += 1
For loop:
for i in range(5):
print(i)
Functions
Reusable block of code:
def greet(name):
print("Hello", name)
greet("Sakinthan")
List (Array)
Store multiple values:
fruits = ["apple", "banana", "mango"]
print(fruits[0]) # Output: apple
Coding Basics Notes for Beginners
First Web Page (HTML)
<!DOCTYPE html>
<html>
<head>
<title>My First Page</title>
</head>
<body>
<h1>Hello World!</h1>
<p>This is my first website.</p>
</body>
</html>