python stuffz
This commit is contained in:
parent
e7d2dd1600
commit
adfe462151
@ -1,18 +1,18 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<HTML lang="en">
|
||||||
<head>
|
<HEAD>
|
||||||
<meta http-equiv="content-type" content="text/html; charset=windows-1252">
|
<META http-equiv="content-type" content="text/html; charset=windows-1252" />
|
||||||
<meta charset="US-ASCII">
|
<META charset="US-ASCII" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<META NAME="viewport" CONTENT="width=device-width, initial-scale=1" />
|
||||||
<title>Deven's Guide to Python</title>
|
<TITLE>Deven's Guide to Python</TITLE>
|
||||||
</head>
|
</HEAD>
|
||||||
<body>
|
<BODY>
|
||||||
<p><a href="..">~ Return</a></p>
|
<P><A HREF="/">~ Return</A></P>
|
||||||
<h1>Deven's Guide to Python</h1>
|
<H1>Deven's Guide to Python</H1>
|
||||||
<h3>Updated 2020-06-04</h3>
|
<H3>Updated 2020-11-17</H3>
|
||||||
|
|
||||||
<hr width="25%" size="1" align="left">
|
<HR width="25%" size="1" align="left" />
|
||||||
<h2>Table of contents</h2>
|
<H2>Table of contents</H2>
|
||||||
<p>
|
<p>
|
||||||
<b><a href="#introduction">What is Python?</a></b><br />
|
<b><a href="#introduction">What is Python?</a></b><br />
|
||||||
<b><a href="#installation">How to install Python</a></b><br />
|
<b><a href="#installation">How to install Python</a></b><br />
|
||||||
@ -151,7 +151,8 @@ HELLO<br />
|
|||||||
WORLD
|
WORLD
|
||||||
</code></p>
|
</code></p>
|
||||||
<p>
|
<p>
|
||||||
You can also use the newline escape character, <code>\n</code>. This is similar to the <code><br /></code> tag in HTML.
|
You can also use the newline escape character, <code>\n</code>.
|
||||||
|
This is similar to the <code><br /></code> tag in HTML.
|
||||||
</p>
|
</p>
|
||||||
<p><code>print("HELLO\nWORLD")</code></p>
|
<p><code>print("HELLO\nWORLD")</code></p>
|
||||||
<p>Will return:</p>
|
<p>Will return:</p>
|
||||||
@ -171,5 +172,28 @@ WORLD''')
|
|||||||
HELLO<br />
|
HELLO<br />
|
||||||
WORLD
|
WORLD
|
||||||
</code></p>
|
</code></p>
|
||||||
</body>
|
<H2 ID="functions">Functions</H2>
|
||||||
|
<P>
|
||||||
|
Functions are the most powerful part of any programming language.
|
||||||
|
In Python functions are themselves variables, with the type <code><class 'function'></code>.
|
||||||
|
In Python a very simple function we can study is the following:
|
||||||
|
</P>
|
||||||
|
<P><CODE>
|
||||||
|
def f():<BR />
|
||||||
|
  return
|
||||||
|
</CODE></P>
|
||||||
|
<P>
|
||||||
|
This function's name is <CODE>f</CODE> and it does everything after the line with <CODE>def</CODE> (so, just <CODE>return</CODE>).
|
||||||
|
That line with <CODE>def</CODE> is actually officially called a <I>function header</I>.
|
||||||
|
I think that's a stupid name personally, I just call it the "line with def" and everybody gets what I'm talking about.
|
||||||
|
</P>
|
||||||
|
<H3>def</H3>
|
||||||
|
<P>
|
||||||
|
<CODE>def</CODE> is a special thing in Python that <B>def</B>ines a function.
|
||||||
|
Y'know words in English? How do those work? I can say something is "cold",
|
||||||
|
but that structure of vowels and consonants isn't <I>cold</I> itself.
|
||||||
|
"Coldness" is a <I>function</I> that can be performed by matter under a specific circumstance,
|
||||||
|
namely, its particles having a below-average level of excitement.
|
||||||
|
</P>
|
||||||
|
</BODY>
|
||||||
</html>
|
</html>
|
Loading…
Reference in New Issue
Block a user