We've created this lesson for you. Now you can improve and extend it! To add more steps, press the blue "Plus" button. To save your changes, press the "Save changes" button at the bottom of the page. Good Luck! Stepik Team.
Examples of different code:
CSS
/* Styling the body of the webpage */
body {
font-family: Arial, sans-serif;
background-color: #f0f0f0;
color: #333;
margin: 0;
padding: 0;
}
/* Styling the header */
header {
background-color: #007bff;
color: white;
text-align: center;
padding: 20px;
}
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Sample Webpage</title>
<link rel="stylesheet" href="styles.css"> <!-- Linking to an external CSS file -->
</head>
<body>
<header>
<h1>Welcome to My Webpage</h1>
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Services</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
</header>
<div class="main-content">
<h2>About Us</h2>
<p>Welcome to our website. We offer various services and more.</p>
<button class="button">Learn More</button>
</div>
<footer>
<p>© 2023 Sample Webpage</p>
</footer>
</body>
</html>
MySQL
-- Create a new database if it doesn't exist
CREATE DATABASE IF NOT EXISTS SampleDB;
-- Use the created database
USE SampleDB;
-- Create a table named 'Users'
CREATE TABLE Users (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(50) NOT NULL,
email VARCHAR(100) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
Yaml
server:
port: 8080
hostname: example.com
timeout: 30
database:
name: my_database
username: my_user
password: my_password
host: localhost
Shell
#!/bin/bash
# Simple script to list files in the current directory
echo "Listing files in the current directory:"
ls -l
TypeScript
// Define an interface for a Person
interface Person {
name: string;
age: number;
email?: string; // Optional property
}
// Function to display information about a person
function displayPersonInfo(person: Person): void {
console.log(`Name: ${person.name}, Age: ${person.age}`);
if (person.email) {
console.log(`Email: ${person.email}`);
}
}
// Example usage
const person1: Person = { name: 'Alice', age: 30 };
const person2: Person = { name: 'Bob', age: 25, email: 'bob@example.com' };
displayPersonInfo(person1);
displayPersonInfo(person2);
Javascript
// Define a function to calculate the area of a rectangle
function calculateRectangleArea(length, width) {
return length * width;
}
// Example usage of the function
const length = 5;
const width = 10;
const area = calculateRectangleArea(length, width);
console.log(`The area of the rectangle is: ${area}`);
Python
def fibonacci_sequence(n):
sequence = []
a, b = 0, 1
for _ in range(n):
sequence.append(a)
a, b = b, a + b
return sequence
# Generating and printing the Fibonacci sequence of 40 numbers
result = fibonacci_sequence(40)
print(result)
Plain
@SRR98765432.1 1 length=71
CGGTAATAGTCACGGTGCTCATGCTTGCTCCTTAAGGGCGTTAACACGCAAAGTAACGGCATTTTTGTGGT
+SRR98765432.1 1 length=71
ACCCCGGGGGGGGFGGGGGGGGGGGGGGGGGGGCAEFDFEEFDFFFF7B:+@8F9,C,+8+@EFFF+C,,,
@SRR98765432.2 2 length=76
GTTTCCCGCTTCGTGCACTGAAATTTTATGATAACGATGGTGCGCGGCAGGAAGTGATTTCCGAAGCCTTTAAATT
+SRR98765432.2 2 length=76
-ACCCGGGGEGGGGFGGFGFCCDFFGGGGF,C@EF@7FDDE,C+@+::++6,,,:,,<<,<6,,,+86C,:,,,,6
@SRR98765432.3 3 length=53
GTGGATGACGGCCCATAACATCGCCTTCGTCGTGGTCAATATCAATATTAACT
+SRR98765432.3 3 length=53
-CCCCGGGGGGGGGGGGGGGGGGGGGGGGGGGGDGGFCFFAFFC,F9EF9<EE
@SRR98765432.4 4 length=75
TGGCAGAACAGCTTGATCAGATGGGCGGCGAGCAGCTGCGTCGCAAAATCGAAAGTATTTGCTTGCGCTTTCACA
+SRR98765432.4 4 length=75
@@CCCGGGGGFGGGGFFFGCFGGFCFCDF7@+@FAEFCF+BF@C:C7CFE7,,,+C,C,,,<,C,:+7+?D<,C,
Java
public class AnimalCare {
public static void main(String[] args) {
System.out.println("I do >love animals!");
System.out.println("Start looking after animals...");
System.out.println("Deer looks fine.");
System.out.println("Bat looks happy.");
System.out.println("Lion looks healthy.");
}
}