-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPython1.html
197 lines (191 loc) · 12.7 KB
/
Python1.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Python Essentials</title>
<link rel="stylesheet" href="python.css">
</head>
<body>
<nav class="navbar">
<div class="logo">
<a href="./index.html">
CODE<span style="color: #ff6f61;">FOAD</span>
</a>
</div>
<ul class="navigationlinks">
<li><a href="./index.html">Home</a></li>
<li class="tutdropdown">
<a>Tutorials</a>
<ul class="tutorialdropdownitems">
<li><a href="">Python Essentials</a></li>
<li><a href="./bashscripting.html">Bash Scripting</a></li>
<li><a href="./html.html">HTML</a></li>
<li><a href="./css.html">CSS</a></li>
</ul>
<li><a href="./index.html#aboutus">About Us</a></li>
<li><a href="./contactus.html">Contact</a></li>
<li><a href="./login.html" class="loginbutton">Login</a></li>
</ul>
</nav>
<div class="py1background">
<div class="pythonhero">
<h1>Welcome! Adventurer</h1>
<p>"Welcome to the Programmers' Forest! Today, we begin our hunt with a 'Python'—a powerful creature in the programming world."</p>
</div>
</div>
<section class="topics">
<div class="themebackground">
<div class="theme">
<h2>🌲✨ Python: The Adventurer's Compass ✨🌲</h2>
<p>Welcome, brave explorer! Python is your enchanted compass, guiding you through the twists and turns of the<b><u><em>Programmers' Forest.</em></u></b>It's not just a language—it's a tool of discovery, crafted for both simplicity and power.</p>
<h3>🗺️ Why Python?</h3>
<ul>
<li>It's as easy to read as the ancient carvings on trees.</li>
<li>It helps you calculate treasures and solve puzzles.</li>
<li>It builds magical tools to shape the world around you.</li>
</ul>
<p>From whispering secrets of code to crafting mighty programs, Python turns challenges into adventures. <b>Ready to wield this power and uncover the forest’s hidden wonders? 🌟</b></p>
</div>
</div>
<div class="topicbackground1">
<div class="topiccontent">
<h3>🌲 Printing a Number 🌲</h3>
<p>Welcome to the first clearing in the <u><em>Programmers' Forest</em></u>, where we discover how to leave our mark in the Python wilderness! <br>The <b>print statement</b> is like carving a message on a tree—it's the way we display information for the world to see. In Python, this tool lets us reveal numbers, words, or even the results of magical expressions hidden in the depths of code.<br><br>Let's start by carving a simple number into the forest's history:</p>
<div class="codebackground">
<p>print("42")</p>
</div>
<a href="./compiler.html" class="tryitbutton" target="_blank">Try It</a><br><br>
<p>This prints <b>42</b>, the legendary number known to adventurers far and wide! Ready to try it yourself? 🌟</p>
</div>
</div>
<div class="topicbackground2">
<div class="topiccontent">
<h3>🌲 Printing Text 🌲</h3>
<p>In the <u><em>Programmers' Forest</em></u>, the <b>print statement</b> isn't just for numbers—it's how we leave <em>messages</em> for fellow adventurers. To print text, use <u><b>quotation marks</b></u> to create your message.<br><br>For example:
</p>
<div class="codebackground">
<p>print("Hello, explorers!")</p>
<p>print("Your Name")</p>
</div>
<a href="./compiler.html" class="tryitbutton" target="_blank">Try It</a><br><br>
<p>Output:<br><b>Hello, explorers!</b><br><br>🍃 Want to mix numbers and text?</p>
<div class="codebackground">
<p>print("The forest has", 42, "hidden treasures.")</p>
</div>
<a href="./compiler.html" class="tryitbutton" target="_blank">Try It</a><br><br>
<p>Output:<br><b>The forest has 42 hidden treasures.</b><br><br>Now it's your turn—what message will you leave in the forest? 🌳</p>
</div>
</div>
<div class="topicbackground1">
<div class="topiccontent">
<h3>🌲 Arithmetic Operations 🌲</h3>
<p>Deep in the <u><em>Programmers' Forest</em></u>, numbers are not just carved—they can also interact! Python allows us to perform <b>arithmetic operations</b>, like adding treasures or dividing tasks, to unlock the secrets of the forest.<br><br>Here are the basic tools of this trade:<br><br><b>⊕ Addition</b> (+): Combine treasures</p>
<div class="codebackground">
<p>print(10 + 5) <span style="opacity: 0.5; font-size: 100%;"># Output: 15</span></p>
</div><br>
<p><b>⊖ Subtraction</b> (-): Remove lost supplies</p>
<div class="codebackground">
<p>print(10 - 5) <span style="opacity: 0.5; font-size: 100%;"># Output: 5</span></p>
</div><br>
<p><b>⊗ Multiplication</b> (*): Multiply paths</p>
<div class="codebackground">
<p>print(10 * 5) <span style="opacity: 0.5; font-size: 100%;"># Output: 50</span></p>
</div><br>
<p><b>⊘ Division</b> (/): Share rations</p>
<div class="codebackground">
<p>print(10 / 5) <span style="opacity: 0.5; font-size: 100%;"># Output: 2</span></p>
</div><br>
<p><b>🍃 <em>A Forest Puzzle:</em></b><br><br>What if you need only the remainder of a division? Use the <b>modulus (%)</b> operator:</p>
<div class="codebackground">
<p>print(17 % 3) <span style="opacity: 0.5; font-size: 100%;"># Output: 2</span></p>
</div><br>
<p><b>🌟 <em>Combine Operations</em></b></p>
<div class="codebackground">
<p>print((10 + 5) * 2) <span style="opacity: 0.5; font-size: 100%;"># Output: 30</span></p>
</div><br>
<a href="./compiler.html" class="tryitbutton" target="_blank">Try It</a><br><br>
</div>
</div>
<div class="topicbackground2">
<div class="topiccontent">
<h3>🌲 Multiple Outputs 🌲</h3>
<p>The <b>Print</b>statement can display multiple items at once. Separate them with commas:</p>
<div class="codebackground">
<p>print("Treasures:", 10, "Lost:", 2) <span style="opacity: 0.5; font-size: 100%;"># Output: Treasures: 10 Lost: 2</span></p>
</div><br><br>
<h3>🌲 Output on the Same Line 🌲</h3>
<p>To print without a new line, use the<span style="background-color: rgb(88, 86, 86);font-size: 100%;"> end </span>parameter:</p>
<div class="codebackground">
<p>print("Exploring", end=" ")</p>
<p>print("the forest") </p>
<p><span style="opacity: 0.5; font-size: 100%;"># Output: Exploring the forest</span></p>
</div>
</div>
</div>
<div class="revisionbackground">
<div class="revision">
<h3>🌲 Forest Trail Recap 🌲</h3><br>
<p><b>1️⃣<em> Printing Numbers:</em></b><br>Carve numbers into the forest's lore:</p>
<div class="codebackground">
<p>print(56 + 5) <span style="opacity: 1; font-size: 100%; color: rgb(167, 161, 161);"># Output: 61</span></p>
</div><br>
<p><b>2️⃣<em> Printing Text:</em></b><br>Leave messages for explorers:</p>
<div class="codebackground">
<p>print("Hello, adventurers!") <span style="opacity: 1; font-size: 100%; color: rgb(167, 161, 161);"># Output: Hello, adventurers!</span></p>
</div><br>
<p><b>3️⃣<em> Mix Numbers & Text:</em></b><br>Combine both to tell stories:</p>
<div class="codebackground">
<p>print("Treasures found:", 10) <span style="opacity: 1; font-size: 100%; color: rgb(167, 161, 161);"># Output: Treasures found: 10</span></p>
</div><br>
<p><b>4️⃣<em> Arithmetic Operations:</em></b><br>Master forest math:</p><br>
<p>• Add treasures: <span style="background-color: rgb(88, 86, 86);"> print(15 + 3) </span> → 18</p><br>
<p>• Subtract losses: <span style="background-color: rgb(88, 86, 86);"> print(18 - 3) </span> → 15</p><br>
<p>• Multiply paths: <span style="background-color: rgb(88, 86, 86);"> print(5 * 3) </span> → 15</p><br>
<p>• Divide supplies: <span style="background-color: rgb(88, 86, 86);"> print(9/3) </span> → 3</p><br>
<p>🌟 Combine these to make your outputs more dynamic. Keep experimenting! 🌳</p><br><br>
</div>
</div>
<div class="exercisesbackground">
<div class="exercises">
<h3><b><em><u>Let's do some fun exercises:</u></em></b></h3><br>
<p><b>🌟 Exercise 1: Forest Welcome Sign</b></p><br>
<p>☞ Write a Python program that prints the following on one line, using multiple <span style="background-color: rgb(88, 86, 86);">print</span> statements:</p>
<pre><b> "Welcome to the forest! Beware of hidden treasures."</b></pre>
<pre> (Hint: Use the "end" parameter to avoid line breaks.)</pre><br>
<a href="./compiler.html" class="tryitbutton" target="_blank">Try It</a><br><br>
<hr style="margin-bottom: 30px;" noshade>
<p><b>🌟 Exercise 2: Treasure Hunt Math</b></p>
<p>☞ You've found 10 gold coins in one part of the forest and 5 more in another.
But you had to spend 3 coins to pay a guide.</p>
<pre> Write a program using arithmetic operations to calculate how many coins you have left.</pre><br>
<a href="./compiler.html" class="tryitbutton" target="_blank">Try It</a><br><br>
<hr style="margin-bottom: 30px;" noshade>
<p><b>🌟 Exercise 3: Forest Inventory Log</b></p>
<p>☞ Write a program to display this inventory using multiple outputs in one print statement:</p>
<pre> <b>• Apples: 15</b></pre>
<pre> <b>• Sword: 2</b></pre>
<pre> <b>• potions: 3</b></pre>
<pre> Output should look like this:</pre>
<pre> "Apples: 15, Swords: 2, Potions: 3"</pre><br>
<a href="./compiler.html" class="tryitbutton" target="_blank">Try It</a><br><br>
</div>
</div>
<div class="applause">
<h3>🎉 Thunderous Applause Fills the Forest! 🎉</h3>
<p>Adventurer, you've taken your first bold steps into Python's enchanted forest and emerged victorious! 🌟 From summoning numbers and weaving words with your <b><em>print()</em></b> spell to mastering the magic of arithmetic operations, you've proven your readiness for greater challenges. The forest hums with your success, and the trees bow in admiration! 🌳✨</p><br>
<p>This was your First Trial, and you've passed with flying colors! But the journey doesn't end here. Deeper into the woods, more spells and secrets await—treasures you've only begun to imagine. 🌌</p>
<p>Steel your courage, sharpen your skills, and let's venture onward. The next path is calling your name! </p>
</div>
</section>
<section class="firstPage">
<a href="Python2.html" class="nextbutton"> 🐾 Let's continue our Journey Through Python's Forest 💫</a>
</section>
<footer>
<div class="footer-container">
<p class="footer-text">© 2024 Made with ❤️ by <span class="highlight">Rohan Kumar</span>, <span class="highlight">Yashraj Chowhan</span>, and <span class="highlight">Suraj Kulkarni</span>.</p>
<p class="footer-text">Empowering the world, one line of code at a time. 🚀</p>
</div>
</footer>
</body>
</html>