The Basic Unit of Code Reuse - Functions
01-Introduction
The washing machine at home only needs to be started with one click, and it will wash clothes following a fixed process. This is the concept of functions.
After defining a piece of logic, each call can execute the fixed program.
02-Answer to Previous Exercise
- Define a variable as guessNumber.
- Continuously compare the input data. If it's greater than the number, prompt "too big".
- If it's less than the number, prompt "too small".
- If it equals the number, prompt "Congratulations, you got it!!"
03-Function Basics
03-Function definition
04-Function calls
05-Function types
04-Advanced Function Usage
06-Lambda expressions
07-Closures
08-Function overloading
09-Operator overloading
05-File APIs
File read/write APIs
06-Exercise
Implement a simple file encryption/decryption tool:
- x -e "xxxx" encrypts and saves the input data to secret.txt
- x -d secret.txt displays the data in secret.txt
Related Reading
Programmer Wanfeng focuses on AI programming training. Beginners can start making AI projects after watching his tutorial 《30 Lessons · AI Programming Training Camp》 co-produced with Turing Community.
🎓 AI 编程实战课程
想系统学习 AI 编程?程序员晚枫的 AI 编程实战课 帮你从零上手!
- 👉 课程报名:点击这里报名,前3讲免费试听
- 👉 免费试看:B站免费试看前3讲,先看看适不适合自己
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 程序员晚枫 - Python自动化办公与AI编程!

