View Single Post
Old 2019-11-03, 04:27   #1
Dylan14
 
Dylan14's Avatar
 
"Dylan"
Mar 2017

58610 Posts
Default A Guide for Python

This thread is intended to be a guide to program in Python, starting (hopefully) from the beginning. It is intended for those using the Colab/Kaggle interface, but it can be useful for those using a standalone Python interpreter.
There is a separate thread for comments (https://mersenneforum.org/showthread.php?t=24906). Post comments on this guide in that thread.

Table of contents:
1. Table of contents (this post)
2. Motivation for this guide https://mersenneforum.org/showpost.p...20&postcount=2
3. How to get/use Python https://mersenneforum.org/showpost.p...21&postcount=3
4. Basic syntax https://mersenneforum.org/showpost.p...94&postcount=4
5. Comment lines https://mersenneforum.org/showpost.p...95&postcount=5
6. Some basic constructs: strings, integers, floats, complexes, bools https://mersenneforum.org/showpost.p...96&postcount=6
7. The "print" command and your first program https://mersenneforum.org/showpost.p...60&postcount=7
8. String concatenation and the "input" command https://mersenneforum.org/showpost.p...08&postcount=8
9. The "format" command https://mersenneforum.org/showpost.p...09&postcount=9
10. If/else, part 1: the if statement and the else statement https://mersenneforum.org/showpost.p...2&postcount=10
11. If/else, part 2: the elif statement https://mersenneforum.org/showpost.p...6&postcount=11
12. Functions https://mersenneforum.org/showpost.p...9&postcount=12
13. A slight digression: modules https://mersenneforum.org/showpost.p...9&postcount=13
14. For loops, part 1: introduction to for loops https://mersenneforum.org/showpost.p...2&postcount=14
15. For loops, part 2: break and continue https://mersenneforum.org/showpost.p...2&postcount=15
16. While loops https://mersenneforum.org/showpost.p...3&postcount=16
17. Putting all the loops together https://mersenneforum.org/showpost.p...0&postcount=17
18. More on strings - indexing, repeating, slicing https://www.mersenneforum.org/showpo...7&postcount=18
19. Miscellaneous string operations https://www.mersenneforum.org/showpo...8&postcount=19
20. Introduction to lists
21. Operations on lists - indexing, slicing, concatentation, etc.
22. The math module
23. The cmath module
24. etc tbd

Last fiddled with by Dylan14 on 2021-01-17 at 15:20 Reason: remove disclaimer warning as the thread is locked
Dylan14 is offline