Want to get started on your coding journey? Experience different programming languages? Or develop your own personal website? You're in the right place!
Explore, learn, and build with the resources we’ve prepared for you.
Python is a high-level, interpreted programming language known for its readability and simplicity. It is widely used for web development, data analysis, artificial intelligence, scientific computing, and more. Here, you'll learn the basics of Python syntax, which will help you write clean and efficient code.
Python uses indentation to define code blocks, making the code more readable. Each block of code is indented consistently. For example, functions, loops, and conditionals are all defined with indentation.
Variables in Python are dynamically typed, which means you don't need to declare their type explicitly. Common data types include integers, floats, strings, and lists. Here's how you can define variables:
# Defining variables
integer_var = 10
float_var = 10.5
string_var = "Hello, Python!"
list_var = [1, 2, 3, 4, 5]
print(integer_var, float_var, string_var, list_var)
Python supports various control structures, such as if statements, loops, and exception handling. Here's an example of a simple if statement and a for loop:
# If statement
number = 10
if number > 5:
print("Number is greater than 5")
# For loop
for i in range(5):
print("Loop iteration:", i)
Below is a basic Python code snippet that demonstrates a simple print statement. This is one of the first things you'll learn in Python:
print("Hello, Python!")
When starting with Python, you may encounter common syntax errors. Here are a few tips for debugging:
Using a Python IDE or editor with built-in syntax checking can help catch these errors early.
Functions in Python allow you to write reusable blocks of code that perform a specific task. Functions can take inputs, process them, and return results. Here's a basic function:
def add(a, b):
return a + b
result = add(5, 3)
print("Sum:", result)
Functions can take parameters, and they can return a value. Here's an example of a function with parameters and a return value:
def multiply(x, y):
return x * y
result = multiply(4, 7)
print("Product:", result)
Functions in Python can have default values for parameters, which will be used if no arguments are passed:
def greet(name="User"):
print("Hello,", name)
greet() # Will use the default value 'User'
greet("Alice") # Will use 'Alice' as the name
Object-Oriented Programming (OOP) is a programming paradigm based on the concept of objects, which are instances of classes. Python allows you to define classes and create objects to model real-world entities.
A class in Python is defined using the class
keyword. Here's an example:
class Dog:
def __init__(self, name, age):
self.name = name
self.age = age
def bark(self):
print(f"{self.name} is barking")
# Create an object (instance) of the Dog class
my_dog = Dog("Buddy", 3)
my_dog.bark() # Output: Buddy is barking
Inheritance allows one class to inherit the properties and methods of another class. Here's an example:
class Animal:
def __init__(self, name):
self.name = name
def speak(self):
print(f"{self.name} makes a sound")
class Dog(Animal):
def speak(self):
print(f"{self.name} barks")
dog = Dog("Rex")
dog.speak() # Output: Rex barks
Modules in Python allow you to organize your code by breaking it into separate files. You can import a module in another file and use its functions or classes.
Python comes with many built-in modules, such as math
and datetime
. You can also create your own modules. Here's an example:
# Importing a built-in module
import math
print(math.sqrt(16)) # Output: 4.0
# Importing a custom module
# Assume you have a file named 'my_module.py' with a function 'greet'
from my_module import greet
greet("Alice") # Output: Hello, Alice
To create your own module, simply write a Python file with functions or classes, and then import it into other files. Here's an example of a module:
# my_module.py
def greet(name):
print(f"Hello, {name}")
# main.py
from my_module import greet
greet("Alice")
Now that you've learned the basics of Python, it's time to explore more advanced topics. These concepts will help you write more efficient and powerful code.
List comprehensions provide a concise way to create lists. Here's an example:
# Traditional way
squares = []
for i in range(10):
squares.append(i**2)
# Using list comprehension
squares = [i**2 for i in range(10)]
Lambda functions are anonymous, inline functions that can take any number of arguments but have only one expression. Here's an example:
# Lambda function
square = lambda x: x ** 2
print(square(5)) # Output: 25
Generators allow you to iterate over large datasets without storing the entire dataset in memory. They yield one item at a time:
def count_up_to(max):
count = 1
while count <= max:
yield count
count += 1
counter = count_up_to(5)
for num in counter:
print(num)
HTML (HyperText Markup Language) is the standard language for creating web pages. Every HTML document follows a specific structure, which is essential for the correct rendering of web content. Here's a basic structure of an HTML document:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML Syntax</title>
</head>
<body>
<h1>Hello, World!</h1>
<p>This is a basic HTML structure.</p>
</body>
</html>
Explanation:
<!DOCTYPE html>
: This declaration tells the browser that the document is using HTML5, which is the latest version of HTML.<html lang="en">
: The html
tag wraps the entire content of the webpage, and the lang="en"
attribute specifies the language of the document (English, in this case).<head>
: The head
section contains metadata about the webpage, such as the title, character encoding, and viewport settings for responsive design. This content is not displayed on the page itself.<meta charset="UTF-8">
: This meta tag defines the character encoding as UTF-8, which supports a wide range of characters and symbols.<meta name="viewport" content="width=device-width, initial-scale=1.0">
: This tag ensures that the webpage is displayed correctly on different devices, making the page responsive.<title>
: The text inside the title
tag is what appears on the browser tab for the webpage.<body>
: The body tag contains all the visible content of the webpage, such as text, images, and other media elements.Here are a few more commonly used HTML elements that can be added to the body of a webpage:
You can create ordered and unordered lists using the <ol>
and <ul>
tags:
<h2>Ordered List Example</h2>
<ol>
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ol>
<h2>Unordered List Example</h2>
<ul>
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ul>
In this example:
<ol>
tag creates an ordered (numbered) list, while the <ul>
tag creates an unordered (bulleted) list.<li>
tag represents each list item.You can also add images using the <img>
tag:
<img src="image.jpg" alt="A descriptive text" width="300" height="200">
Explanation:
src
: The source attribute specifies the URL or path to the image file.alt
: The alternative text for the image, which is displayed if the image fails to load and helps with accessibility.width
and height
: Define the dimensions of the image in pixels.Links are created using the <a>
tag. Here's how to add a hyperlink:
<a href="https://www.example.com" target="_blank">Visit Example</a>
Explanation:
href
: The URL or web address the link points to.target="_blank"
: Opens the link in a new tab.CSS (Cascading Style Sheets) is used to style HTML elements and control the layout of web pages. It allows you to separate content (HTML) from presentation (CSS). Here's a simple example of how to set the background color of a webpage:
body {
background-color: #f4f4f4;
}
In this example, the background-color
property changes the background color of the entire webpage to light gray.
In addition to changing background colors, you can also style text by changing its color. Here's an example:
p {
color: blue;
}
This code will make all paragraphs <p>
appear in blue. You can also use HEX values or RGB to define custom colors:
#3498db
for a specific shade of blue.rgb(52, 152, 219)
to define the same color using red, green, and blue values.CSS allows you to control how text appears on the page. You can change the font family, size, and more. Here's an example:
p {
font-family: Arial, sans-serif;
font-size: 16px;
font-weight: bold;
}
Explanation:
sans-serif
font.The CSS box model controls the spacing, padding, and borders of HTML elements. Here's an example:
div {
width: 300px;
padding: 10px;
border: 2px solid black;
margin: 20px;
}
Explanation:
<div>
to 300px.JavaScript is a programming language used to make web pages interactive. It allows you to respond to user actions, update content dynamically, and handle browser events. Here's a simple example that changes the content of a paragraph when the page loads:
document.getElementById("demo").innerHTML = "Hello, JavaScript!";
Explanation: This JavaScript code finds an HTML element with the id demo
and changes its content to "Hello, JavaScript!".
HTML for this code:
<p id="demo">Original Text</p>
JavaScript allows you to handle events such as clicks, key presses, or page loads. Here's an example where a button click changes the content of a paragraph:
function changeText() {
document.getElementById("demo").innerHTML = "You clicked the button!";
}
The HTML for the button and paragraph would look like this:
<p id="demo">Original Text</p>
<button onclick="changeText()">Click Me</button>
Explanation:
changeText()
when the button is clicked.demo
.JavaScript can also be used to change CSS styles dynamically. Here's an example where clicking a button changes the background color of a <div>
:
function changeBackgroundColor() {
document.getElementById("colorBox").style.backgroundColor = "lightblue";
}
The HTML for this would look like this:
<div id="colorBox" style="width: 100px; height: 100px; background-color: lightgray;"></div>
<button onclick="changeBackgroundColor()">Change Color</button>
Explanation:
changeBackgroundColor()
function, which updates the background color of the <div>
.Welcome! To get started, download the following SHPE WebDev file and open it on the IDE of your choice. Once done, let's begin by understanding the key parts of your index.html
file. You'll be editing the following areas:
This is where you include metadata, links to stylesheets, and set the title of your website.
<head>
<!-- Meta Data -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Fonts -->
<link href="https://fonts.googleapis.com/css?family=Poppins:100,200,300" rel="stylesheet">
<!-- Title -->
<title>Your Website Name</title>
<!-- CSS Files -->
<link rel="stylesheet" href="assets/css/style.css">
</head>
What to Edit:
<title>John Doe Portfolio</title>
The structure of your website is defined by various HTML sections. Let's look at key sections you'll likely edit:
This is your site's main menu.
<nav class="navbar navbar-default bootsnav navbar-fixed dark no-background">
<div class="container">
<!-- Navbar Header -->
<div class="navbar-header">
<!-- Mobile Menu Button -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-menu">
<i class="fa fa-bars"></i>
</button>
<!-- Logo -->
<a class="navbar-brand" href="index.html">Your Name</a>
</div>
<!-- Navbar Menu -->
<div class="collapse navbar-collapse" id="navbar-menu">
<ul class="nav navbar-nav navbar-right">
<li><a href="#about">About</a></li>
<li><a href="#education">Education</a></li>
<li><a href="#experience">Experience</a></li>
<li><a href="#projects">Projects</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</div>
</div>
</nav>
What to Edit:
Your Name
in the logo area with your actual name or logo image.This is the first section visitors see.
<section id="welcome-hero" class="welcome-hero">
<div class="container">
<div class="row">
<div class="col-md-12 text-center">
<div class="header-text">
<h2>hi <span>,</span> i am <br> Your Name <br></h2>
<p>Your Profession</p>
<a href="assets/downloadables/Your_Resume.pdf" download>download resume</a>
</div>
</div>
</div>
</div>
</section>
What to Edit:
Your Name
to your actual name.Your Profession
to reflect what you do (e.g., "Web Developer").Now let's personalize your content.
<section id="about" class="about">
<div class="section-heading text-center">
<h2>about me</h2>
</div>
<div class="container">
<div class="about-content">
<div class="row">
<div class="col-sm-6">
<div class="single-about-txt">
<h3>Brief Introduction</h3>
<p>Detailed description about yourself.</p>
<!-- Contact Info -->
<div class="row">
<div class="col-sm-4">
<div class="single-about-add-info">
<h3>phone</h3>
<p>Your Phone Number</p>
</div>
</div>
<div class="col-sm-4">
<div class="single-about-add-info">
<h3>email</h3>
<p>Your Email</p>
</div>
</div>
<div class="col-sm-4">
<div class="single-about-add-info">
<h3>LinkedIn</h3>
<p><a href="Your LinkedIn URL">LinkedIn Profile</a></p>
</div>
</div>
</div>
</div>
</div>
<div class="col-sm-5">
<div class="single-about-img">
<img src="assets/images/about/your_photo.jpg" alt="profile_image">
</div>
</div>
</div>
</div>
</div>
</section>
What to Edit:
<h3>
and <p>
tags with your own introduction and details.src
attribute of the <img>
tag to your profile picture.Add your educational background here.
<section id="education" class="education">
<div class="section-heading text-center">
<h2>education</h2>
</div>
<div class="container">
<div class="education-horizontal-timeline">
<div class="row">
<div class="col-sm-4">
<div class="single-horizontal-timeline">
<div class="experience-time">
<h2>2015 - 2019</h2>
<h3>Bachelor of Science <span>in</span> Computer Science</h3>
</div>
<div class="timeline-content">
<h4 class="title">University Name</h4>
<h5>City, Country</h5>
<p class="description">Brief description of your studies.</p>
</div>
</div>
</div>
<!-- Add more entries as needed -->
</div>
</div>
</div>
</section>
What to Edit:
Showcase your professional experience.
<section id="experience" class="experience">
<div class="section-heading text-center">
<h2>experience</h2>
</div>
<div class="container">
<div class="experience-content">
<div class="main-timeline">
<ul>
<li>
<div class="single-timeline-box">
<div class="row">
<div class="col-md-5">
<div class="experience-time text-right">
<h2>2020 - Present</h2>
<h3>Software Engineer</h3>
</div>
</div>
<div class="col-md-5">
<div class="timeline-content">
<h4 class="title">Company Name</h4>
<h5>City, Country</h5>
<p class="description">Brief description of your role and achievements.</p>
</div>
</div>
</div>
</div>
</li>
<!-- Add more entries as needed -->
</ul>
</div>
</div>
</div>
</section>
What to Edit:
Display your projects with images and descriptions.
<section id="projects" class="portfolio">
<div class="section-heading text-center">
<h2>Projects</h2>
</div>
<div class="container">
<div class="portfolio-content">
<div class="row">
<div class="col-sm-4">
<div class="item">
<img src="assets/images/portfolio/project1.jpg" alt="Project 1">
<div class="isotope-overlay">
<a href="Project1_URL">
Project Title
</a>
</div>
</div>
</div>
<!-- Add more projects as needed -->
</div>
</div>
</div>
</section>
What to Edit:
Enhance your site with interactive effects.
Add smooth scrolling to your navigation links.
<!-- Include jQuery -->
<script src="assets/js/jquery.js"></script>
<!-- Custom JS -->
<script>
$(document).ready(function(){
$('a[href^="#"]').on('click',function (e) {
e.preventDefault();
var target = this.hash;
$('html, body').animate({
scrollTop: $(target).offset().top
}, 1000);
});
});
</script>
Use CSS classes to add animations.
<!-- In your HTML -->
<div class="animated fadeIn">Your Content</div>
<!-- In your CSS -->
.animated {
animation-duration: 1s;
animation-fill-mode: both;
}
.fadeIn {
animation-name: fadeIn;
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
Note: You can adjust the animation effects by editing or adding classes.
Now, let's deploy your website using GitHub Pages. This free service allows you to host your personal website directly from a GitHub repository.
git init
git add .
git commit -m "Initial commit"
username.github.io
(replace "username" with your GitHub username).git remote add origin https://github.com/username/username.github.io.git
git branch -M main
git push -u origin main
https://username.github.io
.For more detailed instructions on deploying with GitHub Pages, check out the official documentation at GitHub Pages Documentation.
Additional Tips:
Keep your website updated and running smoothly.
Regularly update your site with new projects, experiences, or skills.
Check your site periodically for any issues such as broken links or images.
Use Git to manage changes. Commit and push updates to GitHub to keep your site current.
Add new features or redesign your site as your skills grow.