خطة 100 يوم في الذكاء الاصطناعي

رحلة يومية من أساسيات Python والرياضيات إلى التعلم العميق والمشروع النهائي.

العودة لمسار AI EngineerLEARN · BUILD · PRACTICE
ابدأ من هنا

اقرأ المحتوى كمرحلة تعلّم، وليس كصفحة GitHub

ابدأ بالترتيب، طبّق الأمثلة بيدك، ثم انتقل للجزء التالي. النص الأصلي محفوظ كاملًا، وهذه الواجهة تنظّمه لتصل لما تحتاجه أسرع.

3دقيقة قراءة
10قسم وموضوع
كاملبدون اختصار
اختر المرجع أو الدرس
الجزء 4 من 8

اليوم 3 — أساسيات Python

ORIGINAL CONTENT

Day 3: Python Basics

Welcome to Day 3 of your 100-day AI learning journey! Today, we will start learning Python, a powerful and versatile programming language widely used in AI and data science.

Objectives:

  1. Understand Python syntax.
  2. Learn basic programming concepts in Python.
  3. Follow along with the "Python for Beginners" course.

Topics to Explore:

1. Python Syntax

Python syntax is designed to be readable and straightforward. Key elements include:

  • Variables: Used to store data values.
    CODE EXAMPLE
    x = 5
    y = "Hello, World!"
    

Data Types

Common types include integers, floats, strings, and booleans.

CODE EXAMPLE
age = 25           # int
price = 19.99      # float
name = "Alice"     # str
is_student = True  # bool

Comments

Used to explain code, ignored by the interpreter.

CODE EXAMPLE
# This is a comment

Indentation

Python uses indentation to define blocks of code.

CODE EXAMPLE
if age > 18:
    print("You are an adult.")
  • Control Flow:

    • If-else statements: Used to make decisions in your code.

      CODE EXAMPLE
      if age > 18:
          print("You are an adult.")
      else:
          print("You are a minor.")
      
    • For loops: Used to iterate over a sequence (like a list, tuple, or string).

      CODE EXAMPLE
      for i in range(5):
          print(i)
      
    • While loops: Repeats as long as a condition is true.

      CODE EXAMPLE
      count = 0
      while count < 5:
          print(count)
          count += 1
      
  • Functions:

    • Defining a function: A reusable block of code.

      CODE EXAMPLE
      def greet(name):
          print(f"Hello, {name}!")
      
    • Calling a function:

      CODE EXAMPLE
      greet("Alice")
      

3. Follow Along with "Python for Beginners"

"Python for Beginners" is an excellent resource to start your Python journey. This course covers all the basics and helps you build a strong foundation in Python programming.

Course Details:

  • Duration: Approximately 4-6 hours.
  • Structure:
    • Module 1: Introduction to Python
      • Setting up your development environment.
      • Writing your first Python program.
    • Module 2: Basic Syntax and Data Types
      • Understanding variables, data types, and basic operations.

Course Details:

  • Module 3: Control Flow
    • Writing if-else statements, loops, and understanding logical conditions.
  • Module 4: Functions
    • Creating and using functions to make your code modular and reusable.

Activities:

  • Read: Go through the first few chapters of "Automate the Boring Stuff with Python" by Al Sweigart. This book is available for free online and is a great resource for beginners.
  • Watch: Complete at least the first two modules of the "Python for Beginners" course. Follow along with the exercises and code examples.
  • Practice: Write simple Python programs to reinforce what you’ve learned. Here are a few ideas:
    • Print the numbers 1 to 10.
    • Write a program that asks for the user's name and greets them.
    • Create a function that takes two numbers and returns their sum.

Summary:

Today, you learned the basics of Python syntax and programming concepts. By following along with the "Python for Beginners" course and practicing on your own, you’re laying a strong foundation for your AI journey.

Remember to practice regularly and build small projects to solidify your understanding. Tomorrow, we'll continue with more advanced Python concepts. See you on Day 4!

Happy coding!