::.. =[]= ..::     ::.. =[]= ..::     ::.. =[]= ..::     ::.. =[]= ..::
 

CgAn Course 8: Python101 – introduction to programming

| November 11th, 2017 by Doemela | Comments Off on CgAn Course 8: Python101 – introduction to programming

See https://archive.cyberguerrilla.org/a/2017/cgan-teach-the-world-about-hacking-hacktivism/

[W4RL0RD] Welcome everyone to today’s lesson.
[W4RL0RD] We will talk about the programming language Python.
[W4RL0RD] We will cover some beginner steps.
[W4RL0RD] Like what is Python how to setup the environment and our first program.
[W4RL0RD] First let’s talk about Python.
[W4RL0RD] Python is an open source, object-oriented, high-level powerful programming language.
[W4RL0RD] A Python program is composed of mo9dules.
[W4RL0RD] Modules contain styatements.
[W4RL0RD] Statements contain expressions.
[W4RL0RD] Expressions create and process objects.
[W4RL0RD] It is an easy-to-learn language.
[W4RL0RD] For instance.
[W4RL0RD] In Java to print “Hello, World!” you write public class Hello
[W4RL0RD] {
[W4RL0RD] public static void main(String argv[])
[W4RL0RD] {
[W4RL0RD] System.out.println(“Hello, World!”);
[W4RL0RD] }
[W4RL0RD] }
[W4RL0RD] In Python you just write print(“Hello, World!”)
[W4RL0RD] So let’s setup our environment shall we?
[Aspire] yes
[W4RL0RD] Everyone just type python in your terminal.
[Aspire] ok
[W4RL0RD] Did the interpreter open?
[W4RL0RD] Hold up.
[Aspire] no i have to download it
[user] sudo apt-get install python
[Arkhangel] in Linux I dont think we should download any thing… or I wrong?
[Arkhangel] ah ok xD
[W4RL0RD] Nah it’s ok.
[W4RL0RD] In general better use Python3+.
[W4RL0RD] But it’s ok.
[user] difference ?
[W4RL0RD] You guys downloaded it?
[user] continue
[Aspire] i need some more minute but you can keep going
[W4RL0RD] user: Better development.
[W4RL0RD] Actually active development.
[W4RL0RD] Syntax is different.
[W4RL0RD] Python2.x print is print “Hello World!”
[W4RL0RD] Python3.x is print(“Hello World!”)
[nificis] Hello!How to install python3.x on kali?
[user] sudo apt-get install python
[W4RL0RD] WWe shouldn’t cover this today as it is a big lesson.
[user] W4RL0RD: just continue
[W4RL0RD] nificis: For Python3.x sudo apt intsall python3 or python3.5.
[W4RL0RD] Ok.
[nificis] Thanks
[W4RL0RD] After the installation is succesful we can write our first program.
[W4RL0RD] So let’s open our interpreter by typing python in our terminal.
[Aspire] done
[W4RL0RD] Cool.
[W4RL0RD] Now write print “Hello, World!”
[Aspire] done
[Arkhangel] no ( )?
[Arkhangel] ah ok
[W4RL0RD] No.
[Arkhangel] wrote above
[W4RL0RD] Below the statement you can see Hello, World!
[W4RL0RD] Cool.
[Arkhangel] sorry but why I should use python rather than C/C++? What are the advantages to use Python in term of performance/space allocation wrt C/C++?
[Arkhangel] and what are the data structures available?
[W4RL0RD] We will not cover this today.
[Arkhangel] ah ok
[W4RL0RD] Python is way easier.
[Arkhangel] lol I saw it is harder than C xD
[user] ask the question at the end and let him teach
[Arkhangel] when I used time ago xD
[W4RL0RD] #include [iostream]
[W4RL0RD] int main()
[W4RL0RD] {
[W4RL0RD] std::cout [[ “Hello World” [[ std::endl;
[W4RL0RD] return 0;
[W4RL0RD] }
[W4RL0RD] This prints Hello, World! in C++.
[user] pring “hello”
[W4RL0RD] So Python is easier.
[Arkhangel] ok
[W4RL0RD] Ok now letr’s use another way to print Hello, World! in Python.
[W4RL0RD] Open your favorite text editor.
[W4RL0RD] And write print “Hello, World!”
[W4RL0RD] Now save as “test.py,no quotes.
[W4RL0RD] Save it in any directory you want.
[W4RL0RD] Cool ^^
[W4RL0RD] Now open a terminal in there and type “python test.py”
[W4RL0RD] Should print out “Hello, World!”
[W4RL0RD] OK?
[Aspire] yes
[W4RL0RD] Printed out well?
[Aspire] yes
[W4RL0RD] Cool.
[W4RL0RD] Now open the file once more.
[W4RL0RD] On the top write #!/usr/bin/python and keep the print statement.
[W4RL0RD] Save.
[nificis] Ok
[W4RL0RD] Now assuming you are in Unix/Linux type chmod +x test.py.
[W4RL0RD] And now do ./test.py
[W4RL0RD] Any errors?
[nificis] no
[W4RL0RD] If any Windows users in here tell me.
[Aspire] me
[W4RL0RD] Had any errors?
[Anon_Blackcat01] haha
[W4RL0RD] Actually you should install git.
[Aspire] i executed it with python test.py
[Aspire] no errors
[Aspire] i have kali on dual boot
[W4RL0RD] Cool.
[W4RL0RD] No need to say but chmod won’t work in Windows.
[Aspire] yes
[W4RL0RD] That’s all unfortunately for today.
[Arkhangel] why the lesson is called python101? Why 101?
[user] rlly
[W4RL0RD] My time is up.For any questions ask in here or #python.
[Aspire] ok thanks W4RL0RD
[W4RL0RD] Aspire: Means “introductory”.
[user] great work W4RL0RD
[user] ty for the lesson
[W4RL0RD] Hope you all enjoy this little lesson.
[W4RL0RD] Thanks guys.
[W4RL0RD] No problem.
[Arkhangel] ty
[W4RL0RD] Maybe tomorrow we will continue this.
[W4RL0RD] Goodnight.
[Arkhangel] gn

(Visited 260 times, 1 visits today)

Comments are closed.

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.