Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
2.4 kB · 98 lines
JavaScript
at main
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899import React from 'react';import { Code } from 'bright';import Revealable from '../components/Revealable/Revealable';
function Home() { return ( <main> <h1>Introduction to Python</h1> <h2>Variables and Basic Data Types</h2> <p> Python is a high-level, interpreted programming language. In Python, you don't need to specify the data type of a variable when you declare it. Python automatically determines the data type based on the value you assign. </p>
<Revealable> <Code className="code-snippet" theme="dracula" lang="py"> {FIRST_SNIPPET} </Code> </Revealable>
<h2>Control Flow: Conditionals and Loops</h2> <p> Python has standard control flow structures like if statements, for and while loops. </p>
<Revealable> <Code className="code-snippet" theme="dracula" lang="py"> {SECOND_SNIPPET} </Code> </Revealable>
<h2>Functions and Basic Data Structures</h2>
<p> In Python, you can define your own functions using the def keyword. Python also has built-in data structures like lists and dictionaries. </p>
<Revealable> <Code className="code-snippet" theme="dracula" lang="py"> {THIRD_SNIPPET} </Code> </Revealable> </main> );}
const FIRST_SNIPPET = `\# This is a comment. Python ignores anything after the # symbolname = "John Doe" # This is a stringage = 30 # This is an integerheight = 5.9 # This is a floating point number
# Let's print these outprint("Name:", name)print("Age:", age)print("Height:", height)\`;const SECOND_SNIPPET = `\# If statementif age > 18: print(name, "is an adult.")else: print(name, "is a minor.")
# For loopfor i in range(5): # range(5) generates numbers from 0 to 4 print(i)
# While loopcount = 0while count < 5: print(count) count += 1 # This is the same as 'count = count + 1'\`;const THIRD_SNIPPET = `\# Define a functiondef greet(name): return "Hello, " + name
# Call the functionprint(greet("John Doe"))
# Listfruits = ["apple", "banana", "cherry"]for fruit in fruits: print(fruit)
# Dictionaryperson = {"name": "John Doe", "age": 30, "height": 5.9}for key, value in person.items(): print(key, ":", value)\`;
export default Home;