Let's learn Python together
- Learn by yourself:
- Basic: https://www.coursera.org/learn/python
- Intermediate: https://www.coursera.org/learn/python-network-data
- Other: https://www.py4e.com/lessons
- Use what you learnt to build something cool! then share with everyone.
- Help other friends to learn!
- Meeting: https://tiny.cc/pythonredmond
- Recording: https://tiny.cc/pythonrecording
- In 6 months, you will be to write automated tasks on your computer to do your "work" for you!
- In a year, you will be able to write simple AI program that uses your webcam to recognize your pet vs you!
Build a todo-app to keep track to things that you have to do! In life, very often that we will have things that we want or have to do, but we cannot do it at the moment, so we want to save it for later, and often enough we tend to forget! The less we forget, the more we will be seen as responsible person! Through the course of lessons here, we will continue to improve this big project to add more functionalities! Have fun!
Create your trivia game where you can keep all the data in a JSON file.
In the first Lesson, we are going to be focusing on setting up the python environment, and learn about the basic input and output.
- The program will ask the user to enter "your name". Then it will say back "Hello "
- The program will ask the user to enter a number, then it will print out a number that tripples that!
- You will design temperature converter between Celcius and Farenheit! That's it, be creative and have fun!
- Hint: your program can simply ask for temperature in Farenheit, then out put the result in Celcius. But it could do more that just that 😉
- You will design a currency converter program. Say you want to travel to Europe, and you want know how much your $100 USD is worth in € Euro, etc ...
In Lesson 2, we will learn how to use the magic of python to solve some of the number problems that would have been difficult without the help of computers. eg. What is the next prime number after 1 million/1,000,000
Suggested material:
- https://www.py4e.com/lessons/loops
- https://www.py4e.com/lessons/functions
- https://www.py4e.com/lessons/lists
- https://www.w3schools.com/python/python_arrays.asp
- The program will ask the user to enter a number, then it will print out all the number between 0 and that number.
- The program will ask the user to enter a number, then it will print out "even" or "odd" by checking that number.
- The program will ask the user to enter a number, then it will print out all the even number between 0 and that number.
- The program will ask the user to enter a number, then it will check to see if that is a prime number or not.
- The program will ask the user to enter a number, then it will print out all the prime number between 0 and that number.
- Design a useful calculator! It's entirely up to you to build this calculator as you see fit. It could be as simple as adding 2 number, or it could be more complex to let the user choose to do normal operation (+-*/) or do some some fancy operation like "2 to the power of 3" or "5 factorial". The sky is the limit!
- Say you have a secrete number (between 0 and 1000) in your head or written down somewhere. Design a program to ask a series of question to find out what that number is. The user can only answer "yes" or "no" to the questions. Example questions:
- "Is that number larger than 900?"
- "Is it a 2-digit number?"
- "Is the last digit number even?"
- "Is the number 125?"
In Lesson 3, we will learn about how strings work, how the text in coding works. You will learn about how to do string manipulation and have fun with it
Suggested material:
- Take in a string, then print out each character per line for each loop. Make sure to use 2 different FOR loops and one using WHILE loop! so yes, print out the whole thing 3 times!
- Experiment with ord(character) and chr(number)
- Take in a string, build a simple encryption of that string
- Now take in a encrypted string, then decrypt that string!
- Build a tool to use to encrypt and decrypt text messages! Remember that user experience is important, and be creative!
- Build a encryption/decryption tool that has a concept of a public key and a private key!
In Lesson 4, we will learn about how to store data in files, and read back and edit the files. This will help you store big projects into chunks, and each chunk will produce a data file.
- Make a yourname.txt that has your name in it, then read in that file and print to the screen.
- Write down every number from 1 to 100 to a file number.txt
- Write a program that read in number.txt and then add all the numbers up, and write the result into sum.txt
- Start the BIG PROJECT 1 above, with simple operation like: reading all the tasks from a file, provide option to add a task, remove a task or edit a task.
- Say you have a tasks.txt (eat\n, sleep\n), your todo.py will read in the file and print out all the tasks.
- Provide a menu:
- Add a task
- Remove a task
- Edit a task
- Mark a task as competed
- Print completed tasks
- Exit
- Build a shopping experience! You can specify the list of items in a file (item name with price) , then read in the file data, then provide a shopping experience to the users.
JSON time! We will learn about Dictionary data type and how to use it together with List, then how to store them in files as JSON.
Self-learn: https://www.programiz.com/python-programming/json
-
Make students.json and students.py that reads in the data. Start out simple by having 2 students with just name.
-
Add weight, and books (list) to students.json
-
Upgrade your BIG PROJECT 1 (to-do-list app) to make use of JSON.
-
Add clear screen functionality to improve your app's experience os.system('cls') (remember to import os)
-
We will start on big project 2. Create your own trivia game!
We will learn small things that can make your program better and more fun!
- Add sound
- Clear screen
- Make a turn-base Number Game.