1 + 23
September 21, 2023
____ _ _
| _ \ _ _| |_| |__ ___ _ __
| |_) | | | | __| '_ \ / _ \| '_ \
| __/| |_| | |_| | | | (_) | | | |
|_| \__, |\__|_| |_|\___/|_| |_|
|___/
_____ _ _ _
| ___|__ _ _ _ __ __| | __ _| |_(_) ___ _ __
| |_ / _ \| | | | '_ \ / _` |/ _` | __| |/ _ \| '_ \
| _| (_) | |_| | | | | (_| | (_| | |_| | (_) | | | |
|_| \___/ \__,_|_| |_|\__,_|\__,_|\__|_|\___/|_| |_|
____
/ ___|___ _ _ _ __ ___ ___
| | / _ \| | | | '__/ __|/ _ \
| |__| (_) | |_| | | \__ \ __/
\____\___/ \__,_|_| |___/\___|
Enter code and press Shift + Enter.
We can also run external commands.
assignment-01.qmd index.qmd references.bib script.js
assignments.qmd lab.qmd references.qmd session1.ipynb
_book live-notes.qmd schedule.ipynb styles.css
course.qmd _quarto.yml schedule.qmd syllabus.qmd
____ _ _
| _ \ _ _| |_| |__ ___ _ __
| |_) | | | | __| '_ \ / _ \| '_ \
| __/| |_| | |_| | | | (_) | | | |
|_| \__, |\__|_| |_|\___/|_| |_|
|___/
Jupyter notebooks allows writing notes in markdown.
We can also use bold and italic.
Or add headings using #.
Let’s look at jupyter magic commands!
CPU times: user 25.4 ms, sys: 0 ns, total: 25.4 ms
Wall time: 25.6 ms
499999500000
The above one is a line magic command, where all the code in a single line.
There are also cell-magic commands.
CPU times: user 42.2 ms, sys: 0 ns, total: 42.2 ms
Wall time: 46.9 ms
499999500000
We can use %%file magic command to create a new file, without leaving jupyter notebook.
The %load_problem magic command is used to load a program by its name.
Write a function square to compute the square of a number.
>>> square(4)
16
You can verify your solution using:
%verify_problem square
You can verify the solution using magic command %verify_problem.
Hello, world is a just a single line of code.
Python is dynamically typed, but also strongly typed.
It does not allow operations on incompatible datatypes.
Python has elegant datastructures and built-in functions.
333332833333500000
Find the longest word in the dictionary.
All words in the dictionary are available at /usr/share/dict/words.
How to find the top-5 longest words?
Python has extensive standard library and many third-party libraries.
Let’s find the popular Python repositories on github.
for repo in data['items'][:10]:
print(repo['full_name'])
print(repo['description'])
print(repo['stargazers_count'])
print("---")pallets/flask
The Python micro framework for building web applications.
64196
---
Asabeneh/30-Days-Of-Python
30 days of Python programming challenge is a step-by-step guide to learn the Python programming language in 30 days. This challenge may take more than100 days, follow your own pace. These videos may help too: https://www.youtube.com/channel/UC7PNRuno1rzYPb1xLa4yktw
26222
---
plotly/dash
Data Apps & Dashboards for Python. No JavaScript Required.
19368
---
OpenEthan/SMSBoom
短信轰炸/短信测压/ | 一个健壮免费的python短信轰炸程序,专门炸坏蛋蛋,百万接口,多线程全自动添加有效接口,支持异步协程百万并发,全免费的短信轰炸工具!!hongkonger开发全网首发!!
14046
---
postmanlabs/httpbin
HTTP Request & Response Service, written in Python + Flask.
11965
---
Miserlou/Zappa
Serverless Python
11904
---
miguelgrinberg/flasky
Companion code to my O'Reilly book "Flask Web Development", second edition.
8258
---
benbusby/whoogle-search
A self-hosted, ad-free, privacy-respecting metasearch engine
7836
---
jofpin/trape
People tracker on the Internet: OSINT analysis and research tool by Jose Pino
7701
---
flask-restful/flask-restful
Simple framework for creating REST APIs
6659
---
Python has many datatypes, but we’ll start with the most common ones - numbers, strings and lists.
Python has integers.
10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574698574803934567774824230985421074605062371141877954182153046474983581941267398767559165543946077062914571196477686542167660429831652624386837205668069376
Python has floating point numbers.
checkout https://0.30000000000000004.com/ for explanation.
Pay attention to division of numbers.
The / operatoris a floating point division operator.
If you want integer division, use //.
In python, strings are enclosed in single quotes or double quotes. Both of them mean the same.
Python also supports multi-line strings. Multi-line strings are enclosed in three single or double quotes.
Python strings support unicode characters.
print("అ ఆ ఇ ఈ") # Telugu
print("ಅ ಆ ಇ ಈ") # Kannada
print("அ ஆ இ ஈ") # Tamil
print("അ ആ ഇ ഈ") # Malayalam
print("अ आ इ ई") # Hindiఅ ఆ ఇ ఈ
ಅ ಆ ಇ ಈ
அ ஆ இ ஈ
അ ആ ഇ ഈ
अ आ इ ई
We can also specify the unicode characters using unicode code point.
Python has lists to represent a collection of values.
We can access individual elements of a list using [] operator.
The most common way to provide inputs to a program is through command-line arguments.
In Python, the sys.argv variable maintains the list of command-line arguments passed to the program.
By convention, the first entry is always the program name.
Write a program to print the first command-line argument.
Write a program add.py that takes two numbers as command-line arguments and prints their sum.
$ python add.py 3 4
7
$ python add.py 10 20
30
You can verify your solution using:
%verify_problem add-two-numbers