-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLesson01PythonBasics.txt
More file actions
84 lines (53 loc) · 2.77 KB
/
Lesson01PythonBasics.txt
File metadata and controls
84 lines (53 loc) · 2.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
Topics:
1. programming
2. abstraction and Encapsulation in programming
3. Python Basics , Python Interpreter , Syntax, Data Types
4. Data Types
5. Operations
6. String formating
7. Input and output
8. Control Structures
9. Exception Handling
Activites: Hangman Game
**Check list to Python programming**
Introduction to Python:
Brief history and importance of Python, Python as an Interpreted Language , as a programming Language
Installing Python and an IDE (Integrated Development Environment) like PyCharm or Jupyter Notebook.
**Basic Syntax:**
Variables and data types (integers, floats, strings, booleans).
Basic arithmetic operations (+, -, *, /, //, %).
Printing output using the print() function.
Activity: Write a program that takes two numbers as input from the user, adds them, and prints the result.
**Conditional Statements:**
if, elif, and else statements.
Comparison operators (==, !=, <, >, <=, >=).
Logical operators (and, or, not).
Activity: Write a program that asks the user for their age and prints whether they are eligible to vote or not.
**Loops:**
for loops and while loops.
Using loops to iterate over lists, tuples, and strings.
Activity: Write a program that prints all the even numbers between 1 and 20 using a loop.
**Lists and Tuples:**
Creating and accessing elements in lists and tuples.
List and tuple methods (append(), insert(), remove(), count(), etc.).
Activity: Write a program that takes a list of numbers as input from the user, calculates the sum of all the numbers, and prints the result.
**Strings:**
String concatenation and formatting.
String methods (upper(), lower(), split(), etc.).
Activity: Write a program that asks the user for their first name and last name, then prints their full name in uppercase.
**Functions:**
Defining and calling functions.
Function parameters and return values.
Activity: Write a function that takes two numbers as input and returns their sum.
**Input/Output:**
Getting user input using the input() function.
Reading from and writing to files.
Activity: Write a program that asks the user for their favorite color, stores it in a file, and then reads and prints the color from the file.
**Exception Handling:**
Using try, except, finally blocks to handle errors gracefully.
Activity: Write a program that asks the user to enter a number, catches any ValueError exceptions, and prints a message indicating whether the input was valid or not.
**Introduction to Libraries:**
Importing and using libraries/modules (e.g., random, math).
Activity: Write a program that generates a random number between 1 and 10 and asks the user to guess it.
Project (Optional):
Encourage students to work on a small project to apply what they've learned, such as a simple calculator, a guessing game, or a to-do list manager, Hangman game