-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy pathpython_Basics.html
405 lines (392 loc) · 17.7 KB
/
python_Basics.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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>C++ Basics - The Checklist</title>
<link href="https://api.fontshare.com/v2/css?f[]=nunito@400&f[]=bebas-neue@400&display=swap" rel="stylesheet" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"
integrity="sha512-iBBXm8fW90+nuLcSKlbmrPcLa0OT92xO1BIsZ+ywDWZCvqsWgccV3gFoRBv0z+8dLJgyAHIhR35VZc2oM/gI1w=="
crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="icon" href="./resources/Yellow Abstract Cooking Fire Free Logo.png" />
<link rel="stylesheet" href="styles.css" />
<link rel="stylesheet" href="dark-mode.css" />
<link rel="stylesheet" href="scrollbar.css">
</head>
<body>
<header>
<h1><a href="index.html">The Checklist</a></h1>
</header>
<nav>
<!-- may use this thing later -->
<!-- <ul>
<li><a href="checklist1.html">Checklist 1</a></li>
<li><a href="checklist2.html">Checklist 2</a></li>
</ul> -->
<!-- Add more checklists here -->
<!-- dark mode elements -->
<button class="dark-mode-toggle">
<i class="sun-icon"></i>
<i class="moon-icon"></i>
</button>
</nav>
<main>
<section class="checklist">
<h2>Python Basics</h2>
<ul>
<li class="checklist-item">
<div class="section">
<div class="section-box">
<label class="section-box-label">
<input type="checkbox" class="checkbox" data-checklist="cpp-basics" />
<span class="checkmark"></span>
</label>
</div>
<div class="section-title">
<label class="section-title-label">
Introduction to Python
<span class="dropdown-arrow"></span>
</label>
</div>
</div>
<div class="hidden-text">
<!-- Hidden content for the drop-down menu -->
Python is a widely used general-purpose, high level programming
language. It was created by Guido van Rossum in 1991 and further
developed by the Python Software Foundation. It was designed with
an emphasis on code readability, and its syntax allows programmers
to express their concepts in fewer lines of code.Python is an
interpreted language.
</div>
</li>
<li class="checklist-item">
<div class="section">
<div class="section-box">
<label class="section-box-label">
<input type="checkbox" class="checkbox" data-checklist="cpp-basics" />
<span class="checkmark"></span>
</label>
</div>
<div class="section-title">
<label class="section-title-label">
Defining Variables and Datatypes
<span class="dropdown-arrow"></span>
</label>
</div>
</div>
<div class="hidden-text" style="text-align: start">
<!-- Hidden content for the drop-down menu -->
Learn about variables in Python. Variables are used to store
values in memory. Understanding data types is essential for
efficient memory management and creating robust programs.<br /><br />
To define the variables we simply have to give variable name then
"=" sign the some value.<br />
a = 5 (Integer)<br />
b = 0.5 (double/float)<br />
c = "hello python" (Strings)<br />
d = True (Boolean)<br />
e = 'C'<br />
</div>
</li>
<li class="checklist-item">
<div class="section">
<div class="section-box">
<label class="section-box-label">
<input type="checkbox" class="checkbox" data-checklist="cpp-basics" />
<span class="checkmark"></span>
</label>
</div>
<div class="section-title">
<label class="section-title-label">
Conditions statements
<span class="dropdown-arrow"></span>
</label>
</div>
</div>
<div class="hidden-text" style="text-align: start">
<!-- Hidden content for the drop-down menu -->
Learn about statements in Python. Conditional statements are used
when we can have 2 or more outcomes based on certain situations,
for eg. to define a person eligible for voting or not.<br />
So here we outcomes could be "eligible" if person is 18 or above;
otherwise "not eleigible" as age is less than 18.<br /><br />
Syntax:<br />
age = int(input("Enter age"))<br />
if(age>=18):<br />
print("eleigible")<br />
else:<br />
print("not eleigible")<br />
</div>
</li>
<li class="checklist-item">
<div class="section">
<div class="section-box">
<label class="section-box-label">
<input type="checkbox" class="checkbox" data-checklist="cpp-basics" />
<span class="checkmark"></span>
</label>
</div>
<div class="section-title">
<label class="section-title-label">
Loops
<span class="dropdown-arrow"></span>
</label>
</div>
</div>
<div class="hidden-text" style="text-align: start">
<!-- Hidden content for the drop-down menu -->
Loops are the control statements which allows a set instructions
to run for specific number of times.Lets just we want to print
hello world for 100 times , so would we be writing print("hello
world") 100 times ? definitely NO. what we can do is we can write
a loop statement with range=100 & under it write print("hello
world").<br />
There are 2 types of loops :- "FOR LOOP" & WHILE LOOP<br /><br />
Syntax(FOR LOOP):<br />
for i in range(100):<br />
print("hello world")<br /><br />
OUTPUT = hello world for 100 times in terminal<br /><br />
Syntax(While LOOP):<br />
i=0 <br />
while i
< 100 : <br />
print("hello world")<br /><br />
OUTPUT = hello world for 100 times in terminal
</div>
</li>
<li class="checklist-item">
<div class="section">
<div class="section-box">
<label class="section-box-label">
<input type="checkbox" class="checkbox" data-checklist="cpp-basics" />
<span class="checkmark"></span>
</label>
</div>
<div class="section-title">
<label class="section-title-label">
Functions
<span class="dropdown-arrow"></span>
</label>
</div>
</div>
<div class="hidden-text" style="text-align: start">
<!-- Hidden content for the drop-down menu -->
Functions in python are the piece of code which are highly
re-usable, suppose there are some lines of instructions we want to
execute at some many different points of code, so instead of
writing the same code for everytime we can define "Functions" and
use that fuctions wherever required.<br /><br />
Syntax:<br />
def hello(name):<br />
return "hi",name<br /><br />
//now calling function<br /><br />
hello(aron)<br />
OUTPUT = hi aron
</div>
</li>
<li class="checklist-item">
<div class="section">
<div class="section-box">
<label class="section-box-label">
<input type="checkbox" class="checkbox" data-checklist="cpp-basics" />
<span class="checkmark"></span>
</label>
</div>
<div class="section-title">
<label class="section-title-label">
List
<span class="dropdown-arrow"></span>
</label>
</div>
</div>
<div class="hidden-text" style="text-align: start">
<!-- Hidden content for the drop-down menu -->
Python Lists are just like the arrays, declared in other languages
which is an ordered collection of data. It is very flexible as the
items in a list do not need to be of the same type.The
implementation of Python List is similar to Vectors in C++ or
ArrayList in JAVA. The costly operation is inserting or deleting
the element from the beginning of the List as all the elements are
needed to be shifted. Insertion and deletion at the end of the
list can also become costly in the case where the preallocated
memory becomes full. We can create a list in python as shown
below.List elements can be accessed by the assigned index. In
python starting index of the list, sequence is 0 and the ending
index is (if N elements are there) N-1.<br /><br />
To define Lists we simply have to use square brackets and insert
multiple values in it then assign to some variables as shown
below.<br /><br />
list1 = ['a',1,True,5,6,9,"hello world",6.9]<br />
print(list1)<br />
//Output <br />['a',1,True,5,6,9,"hello world",6.9]<br />
</div>
</li>
<li class="checklist-item">
<div class="section">
<div class="section-box">
<label class="section-box-label">
<input type="checkbox" class="checkbox" data-checklist="cpp-basics" />
<span class="checkmark"></span>
</label>
</div>
<div class="section-title">
<label class="section-title-label">
Tuples
<span class="dropdown-arrow"></span>
</label>
</div>
</div>
<div class="hidden-text" style="text-align: start">
<!-- Hidden content for the drop-down menu -->
Python Tuple is a collection of Python objects much like a list
but Tuples are immutable in nature i.e. the elements in the tuple
cannot be added or removed once created. Just like a List, a Tuple
can also contain elements of various types. In Python, tuples are
created by placing a sequence of values separated by ‘comma’ with
or without the use of parentheses for grouping of the data
sequence. Note: Tuples can also be created with a single element,
but it is a bit tricky. Having one element in the parentheses is
not sufficient, there must be a trailing ‘comma’ to make it a
tuple.<br /><br />
To define Tuples we simply have to use round brackets and insert
multiple values in it then assign to some variables as shown
below.<br /><br />
tuple1 = ('a','b','u')<br />
print(tuple1)<br />
//Output <br />('a','b','u')<br />
</div>
</li>
<li class="checklist-item">
<div class="section">
<div class="section-box">
<label class="section-box-label">
<input type="checkbox" class="checkbox" data-checklist="cpp-basics" />
<span class="checkmark"></span>
</label>
</div>
<div class="section-title">
<label class="section-title-label">
Sets
<span class="dropdown-arrow"></span>
</label>
</div>
</div>
<div class="hidden-text" style="text-align: start">
<!-- Hidden content for the drop-down menu -->
Python Set is an unordered collection of data that is mutable and
does not allow any duplicate element. Sets are basically used to
include membership testing and eliminating duplicate entries. The
data structure used in this is Hashing, a popular technique to
perform insertion, deletion, and traversal in O(1) on average. If
Multiple values are present at the same index position, then the
value is appended to that index position, to form a Linked List.
In, CPython Sets are implemented using a dictionary with dummy
variables, where key beings the members set with greater
optimizations to the time complexity.<br /><br />
To define Sets we simply have to use "set([<somevalues>])" and insert
multiple values in it then assign to some variables as shown
below.<br /><br />
set1 = set(['a','b','u','a','u',])<br />
print(set1)<br />
//Output <br />{'a','b','u'}<br />
</div>
</li>
<li class="checklist-item">
<div class="section">
<div class="section-box">
<label class="section-box-label">
<input type="checkbox" class="checkbox" data-checklist="cpp-basics" />
<span class="checkmark"></span>
</label>
</div>
<div class="section-title">
<label class="section-title-label">
Dictionary
<span class="dropdown-arrow"></span>
</label>
</div>
</div>
<div class="hidden-text" style="text-align: start">
<!-- Hidden content for the drop-down menu -->
Python dictionary is like hash tables in any other language with the time complexity of O(1). It is an
unordered collection of data values, used to store data values like a map, which, unlike other Data Types
that hold only a single value as an element, Dictionary holds the key:value pair. Key-value is provided in
the dictionary to make it more optimized. Indexing of Python Dictionary is done with the help of keys. These
are of any hashable type i.e. an object whose can never change like strings, numbers, tuples, etc. We can
create a dictionary by using curly braces ({}) or dictionary comprehension.<br /><br />
To define Dictionary we simply have to use "{"key":"values"}" and insert
multiple values in it then assign to some variables as shown
below.<br /><br />
dict1 = {"name1":"iphone",name2:"ipad"}<br />
//to access some value by defined key <br />
print(dict1['name1'])<br />
//Output <br />'iphone'<br />
</div>
</li>
<!-- Add more python basics topics here -->
</ul>
</section>
</main>
<!-- Footer section -->
<footer>
<!-- <div class="footer-panel1">
<a href=""> Back to top</a>
</div> -->
<div class="footer-panel2">
<div class="navFooterlinkCol">
<div class="footerlinkcol">Get to Know Us</div>
<ul>
<li class="footlink-li"><a href="#"> About</a></li>
<li class="footlink-li"><a href="#">Careers</a></li>
<li class="footlink-li"><a href="#">Documentation</a></li>
<li class="footlink-li"><a href="#">Computer Science</a></li>
</ul>
</div>
<div class="navFooterlinkCol">
<div class="footerlinkcol">Connect with Us</div>
<ul>
<li class="footlink-li"><a href="#">Facebook</a></li>
<li class="footlink-li"><a href="#">Twitter</a></li>
<li class="footlink-li"><a href="#">Instagram</a></li>
</ul>
</div>
<div class="navFooterlinkCol">
<div class="footerlinkcol">Learn Subjects with Us</div>
<ul>
<li class="footlink-li"><a href="C_Programming.html">C Programming</a></li>
<li class="footlink-li"><a href="C++_Basics.html">C++ Basics</a></li>
<li class="footlink-li"><a href="python_Basics.html">Python Basics</a></li>
<li class="footlink-li"><a href="OOP.html">Object Oriented Programming</a></li>
<li class="footlink-li"><a href="STL.html">Standard Template Library</a></li>
<li class="footlink-li"><a href="WebApp.html">Web Application Fundamentals</a></li>
<li class="footlink-li"><a href="algorithm.html">Algorithm Design Techniques</a></li>
<li class="footlink-li"><a href="JavaBasic.html">Java Basics</a></li>
<li class="footlink-li"><a href="linux.html">Linux Basics</a></li>
<li class="footlink-li"><a href="golang.html">Golang Basics</a></li>
<li class="footlink-li"><a href="frontendProjects.html">Frontend Projects</a></li>
</ul>
</div>
</div>
<div class="footer-panel4">
<div class="pages">
<div class="copyright">
Copyright © <span id="year"></span>, Ujjwal Sharma All Rights Reserved
</div>
</div>
</div>
<!-- Scroll back Button -->
<button onclick="topFunction()" id="myBtn" title="Go to top"><i class='fas fa-arrow-circle-up'
style='font-size:36px'></i></button>
<!-- End of scroll back btton -->
</footer>
<!-- End Footer section -->
<!-- Javascript -->
<script>
document.getElementById('year').innerHTML = new Date().getFullYear();
</script>
<script src="script.js"></script>
<script src="dark-mode.js"></script>
<script src="scrollbar.js"></script>
</body>
</html>