Python Full Course for free 🐍

Bro Code www.youtube.com

簡短摘要

本影片是 Python 入門教學,涵蓋了從環境設定到編寫簡單程式的各個方面。以下是主要內容:

  • Python 的易學性和廣泛應用,以及 Python 開發人員的薪資潛力。
  • 如何下載和安裝 Python 及 PyCharm。
  • 變數、資料類型、字串方法、類型轉換、使用者輸入、數字函式、字串切片、邏輯運算符、迴圈、多重賦值。
  • 如何使用 if 語句、while 迴圈和 for 迴圈來控制程式流程。
  • 如何使用多重賦值簡化程式碼。
  • 如何使用字串方法操作字串。
  • 如何使用類型轉換在不同的資料類型之間轉換。
  • 如何使用使用者輸入與程式互動。
  • 如何使用數字函式執行數學運算。
  • 如何使用字串切片提取字串的一部分。
  • 如何使用邏輯運算符組合條件。
  • 如何使用迴圈重複執行程式碼。
  • 如何使用多重賦值一次賦值多個變數。
  • 如何使用字串方法操作字串。
  • 如何使用類型轉換在不同的資料類型之間轉換。
  • 如何使用使用者輸入與程式互動。
  • 如何使用數字函式執行數學運算。
  • 如何使用字串切片提取字串的一部分。
  • 如何使用邏輯運算符組合條件。
  • 如何使用迴圈重複執行程式碼。
  • 如何使用多重賦值一次賦值多個變數。
  • 如何使用字串方法操作字串。
  • 如何使用類型轉換在不同的資料類型之間轉換。
  • 如何使用使用者輸入與程式互動。
  • 如何使用數字函式執行數學運算。
  • 如何使用字串切片提取字串的一部分。
  • 如何使用邏輯運算符組合條件。
  • 如何使用迴圈重複執行程式碼。
  • 如何使用多重賦值一次賦值多個變數。
  • 如何使用字串方法操作字串。
  • 如何使用類型轉換在不同的資料類型之間轉換。
  • 如何使用使用者輸入與程式互動。
  • 如何使用數字函式執行數學運算。
  • 如何使用字串切片提取字串的一部分。
  • 如何使用邏輯運算符組合條件。
  • 如何使用迴圈重複執行程式碼。
  • 如何使用多重賦值一次賦值多個變數。
  • 如何使用字串方法操作字串。
  • 如何使用類型轉換在不同的資料類型之間轉換。
  • 如何使用使用者輸入與程式互動。
  • 如何使用數字函式執行數學運算。
  • 如何使用字串切片提取字串的一部分。
  • 如何使用邏輯運算符組合條件。
  • 如何使用迴圈重複執行程式碼。
  • 如何使用多重賦值一次賦值多個變數。
  • 如何使用字串方法操作字串。
  • 如何使用類型轉換在不同的資料類型之間轉換。
  • 如何使用使用者輸入與程式互動。
  • 如何使用數字函式執行數學運算。
  • 如何使用字串切片提取字串的一部分。
  • 如何使用邏輯運算符組合條件。
  • 如何使用迴圈重複執行程式碼。
  • 如何使用多重賦值一次賦值多個變數。
  • 如何使用字串方法操作字串。
  • 如何使用類型轉換在不同的資料類型之間轉換。
  • 如何使用使用者輸入與程式互動。
  • 如何使用數字函式執行數學運算。
  • 如何使用字串切片提取字串的一部分。
  • 如何使用邏輯運算符組合條件。
  • 如何使用迴圈重複執行程式碼。
  • 如何使用多重賦值一次賦值多個變數。
  • 如何使用字串方法操作字串。
  • 如何使用類型轉換在不同的資料類型之間轉換。
  • 如何使用使用者輸入與程式互動。
  • 如何使用數字函式執行數學運算。
  • 如何使用字串切片提取字串的一部分。
  • 如何使用邏輯運算符組合條件。
  • 如何使用迴圈重複執行程式碼。
  • 如何使用多重賦值一次賦值多個變數。
  • 如何使用字串方法操作字串。
  • 如何使用類型轉換在不同的資料類型之間轉換。
  • 如何使用使用者輸入與程式互動。
  • 如何使用數字函式執行數學運算。
  • 如何使用字串切片提取字串的一部分。
  • 如何使用邏輯運算符組合條件。
  • 如何使用迴圈重複執行程式碼。
  • 如何使用多重賦值一次賦值多個變數。
  • 如何使用字串方法操作字串。
  • 如何使用類型轉換在不同的資料類型之間轉換。
  • 如何使用使用者輸入與程式互動。
  • 如何使用數字函式執行數學運算。
  • 如何使用字串切片提取字串的一部分。
  • 如何使用邏輯運算符組合條件。
  • 如何使用迴圈重複執行程式碼。
  • 如何使用多重賦值一次賦值多個變數。
  • 如何使用字串方法操作字串。
  • 如何使用類型轉換在不同的資料類型之間轉換。
  • 如何使用使用者輸入與程式互動。
  • 如何使用數字函式執行數學運算。
  • 如何使用字串切片提取字串的一部分。
  • 如何使用邏輯運算符組合條件。
  • 如何使用迴圈重複執行程式碼。
  • 如何使用多重賦值一次賦值多個變數。
  • 如何使用字串方法操作字串。
  • 如何使用類型轉換在不同的資料類型之間轉換。
  • 如何使用使用者輸入與程式互動。
  • 如何使用數字函式執行數學運算。
  • 如何使用字串切片提取字串的一部分。
  • 如何使用邏輯運算符組合條件。
  • 如何使用迴圈重複執行程式碼。
  • 如何使用多重賦值一次賦值多個變數。
  • 如何使用字串方法操作字串。
  • 如何使用類型轉換在不同的資料類型之間轉換。
  • 如何使用使用者輸入與程式互動。
  • 如何使用數字函式執行數學運算。
  • 如何使用字串切片提取字串的一部分。
  • 如何使用邏輯運算符組合條件。
  • 如何使用迴圈重複執行程式碼。
  • 如何使用多重賦值一次賦值多個變數。
  • 如何使用字串方法操作字串。
  • 如何使用類型轉換在不同的資料類型之間轉換。
  • 如何使用使用者輸入與程式互動。
  • 如何使用數字函式執行數學運算。
  • 如何使用字串切片提取字串的一部分。
  • 如何使用邏輯運算符組合條件。
  • 如何使用迴圈重複執行程式碼。
  • 如何使用多重賦值一次賦值多個變數。
  • 如何使用字串方法操作字串。
  • 如何使用類型轉換在不同的資料類型之間轉換。
  • 如何使用使用者輸入與程式互動。
  • 如何使用數字函式執行數學運算。
  • 如何使用字串切片提取字串的一部分。
  • 如何使用邏輯運算符組合條件。
  • 如何使用迴圈重複執行程式碼。
  • 如何使用多重賦值一次賦值多個變數。
  • 如何使用字串方法操作字串。
  • 如何使用類型轉換在不同的資料類型之間轉換。
  • 如何使用使用者輸入與程式互動。
  • 如何使用數字函式執行數學運算。
  • 如何使用字串切片提取字串的一部分。
  • 如何使用邏輯運算符組合條件。
  • 如何使用迴圈重複執行程式碼。
  • 如何使用多重賦值一次賦值多個變數。
  • 如何使用字串方法操作字串。
  • 如何使用類型轉換在不同的資料類型之間轉換。
  • 如何使用使用者輸入與程式互動。
  • 如何使用數字函式執行數學運算。
  • 如何使用字串切片提取字串的一部分。
  • 如何使用邏輯運算符組合條件。
  • 如何使用迴圈重複執行程式碼。
  • 如何使用多重賦值一次賦值多個變數。
  • 如何使用字串方法操作字串。
  • 如何使用類型轉換在不同的資料類型之間轉換。
  • 如何使用使用者輸入與程式互動。
  • 如何使用數字函式執行數學運算。
  • 如何使用字串切片提取字串的一部分。
  • 如何使用邏輯運算符組合條件。
  • 如何使用迴圈重複執行程式碼。
  • 如何使用多重賦值一次賦值多個變數。
  • 如何使用字串方法操作字串。
  • 如何使用類型轉換在不同的資料類型之間轉換。
  • 如何使用使用者輸入與程式互動。
  • 如何使用數字函式執行數學運算。
  • 如何使用字串切片提取字串的一部分。
  • 如何使用邏輯運算符組合條件。
  • 如何使用迴圈重複執行程式碼。
  • 如何使用多重賦值一次賦值多個變數。
  • 如何使用字串方法操作字串。
  • 如何使用類型轉換在不同的資料類型之間轉換。
  • 如何使用使用者輸入與程式互動。
  • 如何使用數字函式執行數學運算。
  • 如何使用字串切片提取字串的一部分。
  • 如何使用邏輯運算符組合條件。
  • 如何使用迴圈重複執行程式碼。
  • 如何使用多重賦值一次賦值多個變數。
  • 如何使用字串方法操作字串。
  • 如何使用類型轉換在不同的資料類型之間轉換。
  • 如何使用使用者輸入與程式互動。
  • 如何使用數字函式執行數學運算。
  • 如何使用字串切片提取字串的一部分。
  • 如何使用邏輯運算符組合條件。
  • 如何使用迴圈重複執行程式碼。
  • 如何使用多重賦值一次賦值多個變數。
  • 如何使用字串方法操作字串。
  • 如何使用類型轉換在不同的資料類型之間轉換。
  • 如何使用使用者輸入與程式互動。
  • 如何使用數字函式執行數學運算。
  • 如何使用字串切片提取字串的一部分。
  • 如何使用邏輯運算符組合條件。
  • 如何使用迴圈重複執行程式碼。
  • 如何使用多重賦值一次賦值多個變數。
  • 如何使用字串方法操作字串。
  • 如何使用類型轉換在不同的資料類型之間轉換。
  • 如何使用使用者輸入與程式互動。
  • 如何使用數字函式執行數學運算。
  • 如何使用字串切片提取字串的一部分。
  • 如何使用邏輯運算符組合條件。
  • 如何使用迴圈重複執行程式碼。
  • 如何使用多重賦值一次賦值多個變數。
  • 如何使用字串方法操作字串。
  • 如何使用類型轉換在不同的資料類型之間轉換。
  • 如何使用使用者輸入與程式互動。
  • 如何使用數字函式執行數學運算。
  • 如何使用字串切片提取字串的一部分。
  • 如何使用邏輯運算符組合條件。
  • 如何使用迴圈重複執行程式碼。
  • 如何使用多重賦值一次賦值多個變數。
  • 如何使用字串方法操作字串。
  • 如何使用類型轉換在不同的資料類型之間轉換。
  • 如何使用使用者輸入與程式互動。
  • 如何使用數字函式執行數學運算。
  • 如何使用字串切片提取字串的一部分。
  • 如何使用邏輯運算符組合條件。
  • 如何使用迴圈重複執行程式碼。
  • 如何使用多重賦值一次賦值多個變數。
  • 如何使用字串方法操作字串。
  • 如何使用類型轉換在不同的資料類型之間轉換。
  • 如何使用使用者輸入與程式互動。
  • 如何使用數字函式執行數學運算。
  • 如何使用字串切片提取字串的一部分。
  • 如何使用邏輯運算符組合條件。
  • 如何使用迴圈重複執行程式碼。
  • 如何使用多重賦值一次賦值多個變數。
  • 如何使用字串方法操作字串。
  • 如何使用類型轉換在不同的資料類型之間轉換。
  • 如何使用使用者輸入與程式互動。
  • 如何使用數字函式執行數學運算。
  • 如何使用字串切片提取字串的一部分。
  • 如何使用邏輯運算符組合條件。
  • 如何使用迴圈重複執行程式碼。
  • 如何使用多重賦值一次賦值多個變數。
  • 如何使用字串方法操作字串。
  • 如何使用類型轉換在不同的資料類型之間轉換。
  • 如何使用使用者輸入與程式互動。
  • 如何使用數字函式執行數學運算。
  • 如何使用字串切片提取字串的一部分。
  • 如何使用邏輯運算符組合條件。
  • 如何使用迴圈重複執行程式碼。
  • 如何使用多重賦值一次賦值多個變數。
  • 如何使用字串方法操作字串。
  • 如何使用類型轉換在不同的資料類型之間轉換。
  • 如何使用使用者輸入與程式互動。
  • 如何使用數字函式執行數學運算。
  • 如何使用字串切片提取字串的一部分。
  • 如何使用邏輯運算符組合條件。
  • 如何使用迴圈重複執行程式碼。
  • 如何使用多重賦值一次賦值多個變數。
  • 如何使用字串方法操作字串。
  • 如何使用類型轉換在不同的資料類型之間轉換。
  • 如何使用使用者輸入與程式互動。
  • 如何使用數字函式執行數學運算。
  • 如何使用字串切片提取字串的一部分。
  • 如何使用邏輯運算符組合條件。
  • 如何使用迴圈重複執行程式碼。
  • 如何使用多重賦值一次賦值多個變數。
  • 如何使用字串方法操作字串。
  • 如何使用類型轉換在不同的資料類型之間轉換。
  • 如何使用使用者輸入與程式互動。
  • 如何使用數字函式執行數學運算。
  • 如何使用字串切片提取字串的一部分。
  • 如何使用邏輯運算符組合條件。
  • 如何使用迴圈重複執行程式碼。
  • 如何使用多重賦值一次賦值多個變數。
  • 如何使用字串方法操作字串。
  • 如何使用類型轉換在不同的資料類型之間轉換。
  • 如何使用使用者輸入與程式互動。
  • 如何使用數字函式執行數學運算。
  • 如何使用字串切片提取字串的一部分。
  • 如何使用邏輯運算符組合條件。
  • 如何使用迴圈重複執行程式碼。
  • 如何使用多重賦值一次賦值多個變數。
  • 如何使用字串方法操作字串。
  • 如何使用類型轉換在不同的資料類型之間轉換。
  • 如何使用使用者輸入與程式互動。
  • 如何使用數字函式執行數學運算。
  • 如何使用字串切片提取字串的一部分。
  • 如何使用邏輯運算符組合條件。
  • 如何使用迴圈重複執行程式碼。
  • 如何使用多重賦值一次賦值多個變數。
  • 如何使用字串方法操作字串。
  • 如何使用類型轉換在不同的資料類型之間轉換。
  • 如何使用使用者輸入與程式互動。
  • 如何使用數字函式執行數學運算。
  • 如何使用字串切片提取字串的一部分。
  • 如何使用邏輯運算符組合條件。
  • 如何使用迴圈重複執行程式碼。
  • 如何使用多重賦值一次賦值多個變數。
  • 如何使用字串方法操作字串。
  • 如何使用類型轉換在不同的資料類型之間轉換。
  • 如何使用使用者輸入與程式互動。
  • 如何使用數字函式執行數學運算。
  • 如何使用字串切片提取字串的一部分。
  • 如何使用邏輯運算符組合條件。
  • 如何使用迴圈重複執行程式碼。
  • 如何使用多重賦值一次賦值多個變數。
  • 如何使用字串方法操作字串。
  • 如何使用類型轉換在不同的資料類型之間轉換。
  • 如何使用使用者輸入與程式互動。
  • 如何使用數字函式執行數學運算。
  • 如何使用字串切片提取字串的一部分。
  • 如何使用邏輯運算符組合條件。
  • 如何使用迴圈重複執行程式碼。
  • 如何使用多重賦值一次賦值多個變數。
  • 如何使用字串方法操作字串。
  • 如何使用類型轉換在不同的資料類型之間轉換。
  • 如何使用使用者輸入與程式互動。
  • 如何使用數字函式執行數學運算。
  • 如何使用字串切片提取字串的一部分。
  • 如何使用邏輯運算符組合條件。
  • 如何使用迴圈重複執行程式碼。
  • 如何使用多重賦值一次賦值多個變數。
  • 如何使用字串方法操作字串。
  • 如何使用類型轉換在不同的資料類型之間轉換。
  • 如何使用使用者輸入與程式互動。
  • 如何使用數字函式執行數學運算。
  • 如何使用字串切片提取字串的一部分。
  • 如何使用邏輯運算符組合條件。
  • 如何使用迴圈重複執行程式碼。
  • 如何使用多重賦值一次賦值多個變數。
  • 如何使用字串方法操作字串。
  • 如何使用類型轉換在不同的資料類型之間轉換。
  • 如何使用使用者輸入與程式互動。
  • 如何使用數字函式執行數學運算。
  • 如何使用字串切片提取字串的一部分。
  • 如何使用邏輯運算符組合條件。
  • 如何使用迴圈重複執行程式碼。
  • 如何使用多重賦值一次賦值多個變數。
  • 如何使用字串方法操作字串。
  • 如何使用類型轉換在不同的資料類型之間轉換。
  • 如何使用使用者輸入與程式互動。
  • 如何使用數字函式執行數學運算。
  • 如何使用字串切片提取字串的一部分。
  • 如何使用邏輯運算符組合條件。
  • 如何使用迴圈重複執行程式碼。
  • 如何使用多重賦值一次賦值多個變數。
  • 如何使用字串方法操作字串。
  • 如何使用類型轉換在不同的資料類型之間轉換。
  • 如何使用使用者輸入與程式互動。
  • 如何使用數字函式執行數學運算。
  • 如何使用字串切片提取字串的一部分。
  • 如何使用邏輯運算符組合條件。
  • 如何使用迴圈重複執行程式碼。
  • 如何使用多重賦值一次賦值多個變數。
  • 如何使用字串方法操作字串。
  • 如何使用類型轉換在不同的資料類型之間轉換。
  • 如何使用使用者輸入與程式互動。
  • 如何使用數字函式執行數學運算。
  • 如何使用字串切片提取字串的一部分。
  • 如何使用邏輯運算符組合條件。
  • 如何使用迴圈重複執行程式碼。
  • 如何使用多重賦值一次賦值多個變數。
  • 如何使用字串方法操作字串。
  • 如何使用類型轉換在不同的資料類型之間轉換。
  • 如何使用使用者輸入與程式互動。
  • 如何使用數字函式執行數學運算。
  • 如何使用字串切片提取字串的一部分。
  • 如何使用邏輯運算符組合條件。
  • 如何使用迴圈重複執行程式碼。
  • 如何使用多重賦值一次賦值多個變數。
  • 如何使用字串方法操作字串。
  • 如何使用類型轉換在不同的資料類型之間轉換。
  • 如何使用使用者輸入與程式互動。
  • 如何使用數字函式執行數學運算。
  • 如何使用字串切片提取字串的一部分。
  • 如何使用邏輯運算符組合條件。
  • 如何使用迴圈重複執行程式碼。
  • 如何使用多重賦值一次賦值多個變數。
  • 如何使用字串方法操作字串。
  • 如何使用類型轉換在不同的資料類型之間轉換。
  • 如何使用使用者輸入與程式互動。
  • 如何使用數字函式執行數學運算。
  • 如何使用字串切片提取字串的一部分。
  • 如何使用邏輯運算符組合條件。
  • 如何使用迴圈重複執行程式碼。
  • 如何使用多重賦值一次賦值多個變數。
  • 說明如何使用字串方法操作字串。
  • 說明如何使用類型轉換在不同的資料類型之間轉換。
  • 說明如何使用使用者輸入與程式互動。
  • 說明如何使用數字函式執行數學運算。
  • 說明如何使用字串切片提取字串的一部分。
  • 說明如何使用邏輯運算符組合條件。
  • 說明如何使用迴圈重複執行程式碼。
  • 說明如何使用多重賦值一次賦值多個變數。
  • 說明如何使用字串方法操作字串。
  • 說明如何使用類型轉換在不同的資料類型之間轉換。
  • 說明如何使用使用者輸入與程式互動。
  • 說明如何使用數字函式執行數學運算。
  • 說明如何使用字串切片提取字串的一部分。
  • 說明如何使用邏輯運算符組合條件。
  • 說明如何使用迴圈重複執行程式碼。
  • 說明如何使用多重賦值一次賦值多個變數。
  • 說明如何使用字串方法操作字串。
  • 說明如何使用類型轉換在不同的資料類型之間轉換。
  • 說明如何使用使用者輸入與程式互動。
  • 說明如何使用數字函式執行數學運算。
  • 說明如何使用字串切片提取字串的一部分。
  • 說明如何使用邏輯運算符組合條件。
  • 說明如何使用迴圈重複執行程式碼。
  • 說明如何使用多重賦值一次賦值多個變數。
  • 說明如何使用字串方法操作字串。
  • 說明如何使用類型轉換在不同的資料類型之間轉換。
  • 說明如何使用使用者輸入與程式互動。
  • 說明如何使用數字函式執行數學運算。
  • 說明如何使用字串切片提取字串的一部分。
  • 說明如何使用邏輯運算符組合條件。
  • 說明如何使用迴圈重複執行程式碼。
  • 說明如何使用多重賦值一次賦值多個變數。
  • 說明如何使用字串方法操作字串。
  • 說明如何使用類型轉換在不同的資料類型之間轉換。
  • 說明如何使用使用者輸入與程式互動。
  • 說明如何使用數字函式執行數學運算。
  • 說明如何使用字串切片提取字串的一部分。
  • 說明如何使用邏輯運算符組合條件。
  • 說明如何使用迴圈重複執行程式碼。
  • 說明如何使用多重賦值一次賦值多個變數。
  • 說明如何使用字串方法操作字串。
  • 說明如何使用類型轉換在不同的資料類型之間轉換。
  • 說明如何使用使用者輸入與程式互動。
  • 說明如何使用數字函式執行數學運算。
  • 說明如何使用字串切片提取字串的一部分。
  • 說明如何使用邏輯運算符組合條件。
  • 說明如何使用迴圈重複執行程式碼。
  • 說明如何使用多重賦值一次賦值多個變數。
  • 說明如何使用字串方法操作字串。
  • 說明如何使用類型轉換在不同的資料類型之間轉換。
  • 說明如何使用使用者輸入與程式互動。
  • 說明如何使用數字函式執行數學運算。
  • 說明如何使用字串切片提取字串的一部分。
  • 說明如何使用邏輯運算符組合條件。
  • 說明如何使用迴圈重複執行程式碼。
  • 說明如何使用多重賦值一次賦值多個變數。
  • 說明如何使用字串方法操作字串。
  • 說明如何使用類型轉換在不同的資料類型之間轉換。
  • 說明如何使用使用者輸入與程式互動。
  • 說明如何使用數字函式執行數學運算。
  • 說明如何使用字串切片提取字串的一部分。
  • 說明如何使用邏輯運算符組合條件。
  • 說明如何使用迴圈重複執行程式碼。
  • 說明如何使用多重賦值一次賦值多個變數。
  • 說明如何使用字串方法操作字串。
  • 說明如何使用類型轉換在不同的資料類型之間轉換。
  • 說明如何使用使用者輸入與程式互動。
  • 說明如何使用數字函式執行數學運算。
  • 說明如何使用字串切片提取字串的一部分。
  • 說明如何使用邏輯運算符組合條件。
  • 說明如何使用迴圈重複執行程式碼。
  • 說明如何使用多重賦值一次賦值多個變數。
  • 說明如何使用字串方法操作字串。
  • 說明如何使用類型轉換在不同的資料類型之間轉換。
  • 說明如何使用使用者輸入與程式互動。
  • 說明如何使用數字函式執行數學運算。
  • 說明如何使用字串切片提取字串的一部分。
  • 說明如何使用邏輯運算符組合條件。
  • 說明如何使用迴圈重複執行程式碼。
  • 說明如何使用多重賦值一次賦值多個變數。
  • 說明如何使用字串方法操作字串。
  • 說明如何使用類型轉換在不同的資料類型之間轉換。
  • 說明如何使用使用者輸入與程式互動。
  • 說明如何使用數字函式執行數學運算。
  • 說明如何使用字串切片提取字串的一部分。
  • 說明如何使用邏輯運算符組合條件。
  • 說明如何使用迴圈重複執行程式碼。
  • 說明如何使用多重賦值一次賦值多個變數。
  • 說明如何使用字串方法操作字串。
  • 說明如何使用類型轉換在不同的資料類型之間轉換。
  • 說明如何使用使用者輸入與程式互動。
  • 說明如何使用數字函式執行數學運算。
  • 說明如何使用字串切片提取字串的一部分。
  • 說明如何使用邏輯運算符組合條件。
  • 說明如何使用迴圈重複執行程式碼。
  • 說明如何使用多重賦值一次賦值多個變數。
  • 說明如何使用字串方法操作字串。
  • 說明如何使用類型轉換在不同的資料類型之間轉換。
  • 說明如何使用使用者輸入與程式互動。
  • 說明如何使用數字函式執行數學運算。
  • 說明如何使用字串切片提取字串的一部分。
  • 說明如何使用邏輯運算符組合條件。
  • 說明如何使用迴圈重複執行程式碼。
  • 說明如何使用多重賦值一次賦值多個變數。
  • 說明如何使用字串方法操作字串。
  • 說明如何使用類型轉換在不同的資料類型之間轉換。
  • 說明如何使用使用者輸入與程式互動。
  • 說明如何使用數字函式執行數學運算。
  • 說明如何使用字串切片提取字串的一部分。
  • 說明如何使用邏輯運算符組合條件。
  • 說明如何使用迴圈重複執行程式碼。
  • 說明如何使用多重賦值一次賦值多個變數。
  • 說明如何使用字串方法操作字串。
  • 說明如何使用類型轉換在不同的資料類型之間轉換。
  • 說明如何使用使用者輸入與程式互動。
  • 說明如何使用數字函式執行數學運算。
  • 說明如何使用字串切片提取字串的一部分。
  • 說明如何使用邏輯運算符組合條件。
  • 說明如何使用迴圈重複執行程式碼。
  • 說明如何使用多重賦值一次賦值多個變數。
  • 說明如何使用字串方法操作字串。
  • 說明如何使用類型轉換在不同的資料類型之間轉換。
  • 說明如何使用使用者輸入與程式互動。
  • 說明如何使用數字函式執行數學運算。
  • 說明如何使用字串切片提取字串的一部分。
  • 說明如何使用邏輯運算符組合條件。
  • 說明如何使用迴圈重複執行程式碼。
  • 說明如何使用多重賦值一次賦值多個變數。
  • 說明如何使用字串方法操作字串。
  • 說明如何使用類型轉換在不同的資料類型之間轉換。
  • 說明如何使用使用者輸入與程式互動。
  • 說明如何使用數字函式執行數學運算。
  • 說明如何使用字串切片提取字串的一部分。
  • 說明如何使用邏輯運算符組合條件。
  • 說明如何使用迴圈重複執行程式碼。
  • 說明如何使用多重賦值一次賦值多個變數。
  • 說明如何使用字串方法操作字串。
  • 說明如何使用類型轉換在不同的資料類型之間轉換。
  • 說明如何使用使用者輸入與程式互動。
  • 說明如何使用數字函式執行數學運算。
  • 說明如何使用字串切片提取字串的一部分。
  • 說明如何使用邏輯運算符組合條件。
  • 說明如何使用迴圈重複執行程式碼。
  • 說明如何使用多重賦值一次賦值多個變數。
  • 說明如何使用字串方法操作字串。
  • 說明如何使用類型轉換在不同的資料類型之間轉換。
  • 說明如何使用使用者輸入與程式互動。
  • 說明如何使用數字函式執行數學運算。
  • 說明如何使用字串切片提取字串的一部分。
  • 說明如何使用邏輯運算符組合條件。
  • 說明如何使用迴圈重複執行程式碼。
  • 說明如何使用多重賦值一次賦值多個變數。
  • 說明如何使用字串方法操作字串。
  • 說明如何使用類型轉換在不同的資料類型之間轉換。
  • 說明如何使用使用者輸入與程式互動。
  • 說明如何使用數字函式執行數學運算。
  • 說明如何使用字串切片提取字串的一部分。
  • 說明如何使用邏輯運算符組合條件。
  • 說明如何使用迴圈重複執行程式碼。
  • 說明如何使用多重賦值一次賦值多個變數。
  • 說明如何使用字串方法操作字串。
  • 說明如何使用類型轉換在不同的資料類型之間轉換。
  • 說明如何使用使用者輸入與程式互動。
  • 說明如何使用數字函式執行數學運算。
  • 說明如何使用字串切片提取字串的一部分。
  • 說明如何使用邏輯運算符組合條件。
  • 說明如何使用迴圈重複執行程式碼。
  • 說明如何使用多重賦值一次賦值多個變數。
  • 說明如何使用字串方法操作字串。
  • 說明如何使用類型轉換在不同的資料類型之間轉換。
  • 說明如何使用使用者輸入與程式互動。
  • 說明如何使用數字函式執行數學運算。
  • 說明如何使用字串切片提取字串的一部分。
  • 說明如何使用邏輯運算符組合條件。
  • 說明如何使用迴圈重複執行程式碼。
  • 說明如何使用多重賦值一次賦值多個變數。
  • 說明如何使用字串方法操作字串。
  • 說明如何使用類型轉換在不同的資料類型之間轉換。
  • 說明如何使用使用者輸入與程式互動。
  • 說明如何使用數字函式執行數學運算。
  • 說明如何使用字串切片提取字串的一部分。
  • 說明如何使用邏輯運算符組合條件。
  • 說明如何使用迴圈重複執行程式碼。
  • 說明如何使用多重賦值一次賦值多個變數。
  • 說明如何使用字串方法操作字串。
  • 說明如何使用類型轉換在不同的資料類型之間轉換。
  • 說明如何使用使用者輸入與程式互動。
  • 說明如何使用數字函式執行數學運算。
  • 說明如何使用字串切片提取字串的一部分。
  • 說明如何使用邏輯運算符組合條件。
  • 說明如何使用迴圈重複執行程式碼。
  • 說明如何使用多重賦值一次賦值多個變數。
  • 說明如何使用字串方法操作字串。
  • 說明如何使用類型轉換在不同的資料類型之間轉換。
  • 說明如何使用使用者輸入與程式互動。
  • 說明如何使用數字函式執行數學運算。
  • 說明如何使用字串切片提取字串的一部分。
  • 說明如何使用邏輯運算符組合條件。
  • 說明如何使用迴圈重複執行程式碼。
  • 說明如何使用多重賦值一次賦值多個變數。
  • 說明如何使用字串方法操作字串。
  • 說明如何使用類型轉換在不同的資料類型之間轉換。
  • 說明如何使用使用者輸入與程式互動。
  • 說明如何使用數字函式執行數學運算。
  • 說明如何使用字串切片提取字串的一部分。
  • 說明如何使用邏輯運算符組合條件。
  • 說明如何使用迴圈重複執行程式碼。
  • 說明如何使用多重賦值一次賦值多個變數。
  • 說明如何使用字串方法操作字串。
  • 說明如何使用類型轉換在不同的資料類型之間轉換。
  • 說明如何使用使用者輸入與程式互動。
  • 說明如何使用數字函式執行數學運算。
  • 說明如何使用字串切片提取字串的一部分。
  • 說明如何使用邏輯運算符組合條件。
  • 說明如何使用迴圈重複執行程式碼。
  • 說明如何使用多重賦值一次賦值多個變數。
  • 說明如何使用字串方法操作字串。
  • 說明如何使用類型轉換在不同的資料類型之間轉換。
  • 說明如何使用使用者輸入與程式互動。
  • 說明如何使用數字函式執行數學運算。
  • 說明如何使用字串切片提取字串的一部分。
  • 說明如何使用邏輯運算符組合條件。
  • 說明如何使用迴圈重複執行程式碼。
  • 說明如何使用多重賦值一次賦值多個變數。
  • 說明如何使用字串方法操作字串。
  • 說明如何使用類型轉換在不同的資料類型之間轉換。
  • 說明如何使用使用者輸入與程式互動。
  • 說明如何使用數字函式執行數學運算。
  • 說明如何使用字串切片提取字串的一部分。
  • 說明如何使用邏輯運算符組合條件。
  • 說明如何使用迴圈重複執行程式碼。
  • 說明如何使用多重賦值一次賦值多個變數。
  • 說明如何使用字串方法操作字串。
  • 說明如何使用類型轉換在不同的資料類型之間轉換。
  • 說明如何使用使用者輸入與程式互動。
  • 說明如何使用數字函式執行數學運算。
  • 說明如何使用字串切片提取字串的一部分。
  • 說明如何使用邏輯運算符組合條件。
  • 說明如何使用迴圈重複執行程式碼。
  • 說明如何使用多重賦值一次賦值多個變數。
  • 說明如何使用字串方法操作字串。
  • 說明如何使用類型轉換在不同的資料
Summarize any YouTube video in seconds

Get summaries like this one for any video, in your language, with the free Summ app.

Download on the Apple Store
Get it on Google Play

Transcript

YouTube Transcript Generator

0:00 hey what's going on everybody it's bro hope you're doing well and in this video i'm going to help you get started with python so sit back relax and enjoy the show if you wouldn't mind please like comment and subscribe one like equals one prayer for the youtube algorithm i'm gonna tell you why you need to learn python it's the easiest programming language to learn as well as being the most popular in the world right now and according to glassdoor the salary for new python developers in the united states is 64 000 if any of this sounds good to you well then let's get started if you need to download python go to python.org downloads and click this yellow download python button open when done check add

0:47 python 3.9 or another version to path install now and then give it a little bit it states here that setup was successful so let's close out of this our next step is to download an ide that's an acronym for integrated development environment think of it as software that helps us write other software one ide that i recommend is pycharm you can find it at jetbrains.com pycharm go to download if you would like to pay for a professional version you can click this download button but since i don't like to pay for things i'm going to use the free community version at this point we just have to follow the standard installation procedure click next you can pick a destination folder but i'll keep the default

1:34 next if you would like a desktop shortcut then check this i would also recommend updating the path variable next install and then give it a minute or two then after finishing i have a desktop shortcut so i can just click on this to run pycharm let's create a new project name this project whatever you like i'm going to name this project hello world and i recommend not creating a main dot pi welcome script right now i'll show you how to do that manually and let's create if you need a python file to work with this is how to create one go to file new python file and i'm going to name this main and then click python file

2:23 all right ladies and gentlemen we now have an empty python script that we can use to begin coding now if you checked this box create a main.pi welcome script and then created a new project then your main python file will probably look a little something like this but that's completely fine we can just delete this i don't know about you guys but the font is very small for me so let's change that we can change that by going to file settings editor font and you can increase the font size let's say 25 you can also change the font too what's a good one uh how about that then click apply and okay much better we can actually see something to run a python script just click the

3:09 screen play button in the corner alternatively you can go to the run tab and then go to run okay so this box that appeared at the bottom this is referred to as a terminal window this will display any output that your program has and this line at the end process finished with exit code zero that just means that there were no errors in this program so currently this program doesn't do anything but let's change that let's print something let's print a message so to print a message to the terminal window type print and then add a set of parentheses and then you can type a message but it has to be within quotes either double quotes or single quotes it doesn't matter so let's think of a message i don't know i love pizza then let me run this

3:57 and in my terminal window it says i love pizza to print another line just add another print statement print and then your message within quotes it's really good and well what do you know it printed i love pizza it's really good so ladies and gentlemen you just wrote your first python program by the way you can change the font as well as the font color of your terminal window by going to file settings then go to editor color scheme console font and console colors let's change the font let's say i would like whatever this font is then click apply

4:43 let's change the font color too by going to console colors for any output you can click number two and select a color let's say i would like bright green that should be decent and for anything else let's say this will be a dark color so i can barely see it so then let's click apply and okay oh yeah that's much better well everybody that was your very first python program i'll post any useful links and timestamps for this video in the comments section down below but yeah welcome to coding with python hey you yeah i'm talking to you if you learned something new then help me help you in three easy

5:28 steps by smashing that like button drop a comment down below and subscribe if you'd like to become a fellow bro [Music] hey what's going on everybody it's bro hope you're doing well and in this video i'm going to explain how variables work in python so sit back relax and enjoy the show if you find this video helpful please remember to like comment and subscribe your support will

6:15 help keep this channel running all right let's do this a variable is a container for a value it behaves as the value that it contains it's much like in algebra lessons back in the day where we had to solve for whatever value x was and then we can reuse x and it behaved exactly as that value well with programming we can do that plus we can assign variables of different data types so they are not limited to just numbers we can assign whole words numbers and even these things called booleans which are either true or false but i'll get more in depth into data types a little bit later on in this video so let's create a variable and this is how to do so we need a unique name for this variable let's say name name equals some value now the first data type that we'll cover is strings a string

7:01 is a series of characters so to create a string we can either use single quotes or double quotes in python and we can assign this a value of whatever your own name is so i will assign this variable name a value of bro now this variable will behave exactly as if it was this value this name and then we can reuse this variable for something so let's print whatever our name is print name and this will print whatever your name is to the console window now when you print your variable make sure you don't put it within quotes because what we're doing then is literally printing the word name as you can see here so if you need to use your variable for something make sure it's not within quotes now we can combine our string variable

7:48 with another string so within our print statement let's print a string literal such as hello space plus name so we are combining strings and then we're printing the results to the console window so this will print hello bro now you can actually check the data type of a variable so i'm going to turn this line into a comment so what you'll do is take the name of the variable surround this with a set of parentheses and then precede the set of parentheses with the type function and this will print the data type of this variable to the console window and you can see that it says class str short for string a string is a series of characters a name is a good example of a string a series of characters so that is how to check the data type

8:34 of a variable just use the type function now you can actually combine variables together as long as they're of the same data type so let's change our name to maybe first name and we'll create a second variable called lastname now a common naming convention with variables if it has two words separate each word with an underscore it's not necessary but it's common practice for python and honestly i sometimes forget about that but don't tell anybody so let's create another variable called last name last name equals whatever your last name is and then let's create a third variable called full name full underscore name and let's combine first name plus last name and let us display full name

9:22 along with hello plus full name now these two names were combined together to create a whole new variable actually what i think i'll do is add a space within my variable so i'm doing a bunch of string concatenation i'm combining the variable first name plus a space character plus last name so the result is hello whatever your first name and last name is so that is a variable of the string data type it is a series of characters now with strings we cannot normally use these for any sort of math that's where the next data type comes in for the time being i just turned all of these lines into comments and we are going to move on to the int data type short for integer this time let's create a variable called age and we will assign this a value of

10:08 whatever your age is let's just say that i'm 21 now when you assign a value of the int data type make sure that it is not within quotes because then technically it would be a string then and you can see that the color scheme for this number actually changed so if this was a string we would treat it different than an int data type because with strings we cannot normally use them for any sort of math so we now have a variable called edge and we can actually increase or decrease or do whatever we want with the edge let's increase our age by one let's say it's our birthday to do so we would say age equals age plus one and then let's print our edge to the console window print edge and you can see that it says i am 22. now there's a shorthand way of writing

10:53 this what you'll do is type age plus equals one so that's kind of like a shortcut and this would work the same too now let's print the data type of our inch variable because we can within a print statement i will print the edge and add my edge variable to this type function and this will print the data type of my edge variable to the console window and i will turn this line into a comment just so that it doesn't get in the way now if i were to print the data type of my age variable as you can see it is of the int data type short for integer it only stores a whole integer number now what if this was a string so what i'm going to do is surround my value within a set of quotes and i will turn this line into a comment

11:39 so that it does not get in the way you can see that the data type of my age variable is now a string and with strings we cannot normally use them for any sort of math so let's attempt to increase our age variable by one and we ran into an error a type air can only concatenate string to string not end now the point being is that it's important to use the appropriate data type because with strings we cannot normally use them for any sort of math you'll want to use a data type of a numeric value an int or a float which we'll discuss a little bit later now here's a situation to consider what if we would like to display our edge variable along with a string literal much like what we did with this line involving a string literal such as hello plus the user's full name so let's

12:25 attempt to do so and this is not going to work and i'll explain why so within our print statement let's say something such as your age is plus edge now we're going to run into a type error that's because we attempted to use string concatenation with a string literal and a variable of a different data type a variable of the int data type in order to display our edge along with the string we would need to convert our edge variable to the string data type and one way in which we can do that is by type casting and we'll cover this more in the next video so we're going to surround our age variable that is of the in data type with a set of parentheses and precede this with str short for string and this will convert our

13:11 variable to a string that will allow us to display it with another string now if we were to run this program this way this will now display your age is and in this case 22 so if you need to display a variable of a different data type along with the string you would just need to use a stringcast to convert that data type to a string but we'll cover this more in the next video on typecasting so that is the int data type it stores a whole integer number and the next data type is the float data type and i'm going to turn these lines into comments and we can move on now the float data type is a numeric value that can store a number that includes a decimal portion an int data type cannot store a decimal portion that's why it's in short for integer it only stores a whole

13:58 number this time let's say we have a height and i will assign this a perfectly normal height of maybe 250.5 centimeters so this decimal portion is important that's indicating that this is a floating point number a float for short so let's print our height to the console window print height and this will print whatever my height is and now let's check the type of our height using the type function so within a print statement i'm going to add my height surround this with another set of parentheses and precede this with the type function and the data type of my variable height is a float short for a floating point number a numeric value that contains a decimal portion and now for practice let's print our

14:44 height along with a string literal so let's create a string literal such as your height is plus height but guess what we're going to do some type casting so surround height with a set of parentheses and precede this with str so that we convert height to a string so that we can use string concatenation within this print statement and this will print the message your height is 250.5 actually let's add centimeters to the end so plus cm and there we go and that is what a floating point number is float for short it is a numeric value that contains a decimal portion now the last data type that we're going to cover is the boolean data type it is a variable that can only

15:30 store true or false let's say we have a variable called human if we were to assign this a boolean value this would be either true or false and we can print whatever this value is let's print whatever human is and this will display false now the reason that you may want to use booleans instead of strings even though you can still store a string representation of the word false or true is that these are very useful when we get to if statements we can check to see if some statement is true so that is a good use of boolean values now let's check the data type of my human variable so let's print type human and this will print to the console window

16:16 bool short for boolean now make sure you're not putting this within quotes because then it's technically a string and they behave differently now the data type is a string and you may have noticed as well that the font color has changed between strings and boolean values so that's another good indicator now what if you need to display your value along with a string using string concatenation well guess what we're going to typecast again so let's print something r u a human so we need to use string concatenation so i will convert my boolean variable of human to a string and i have been programmed to inform you that yes i am in fact a human that is true

17:01 well everyone that is the basics of variables it is a container for a value and they behave as the value that they contain there are four basic data types strings which store a series of characters inc which store a whole integer floats which are floating point numbers a numeric value with a decimal and booleans which only store true or false and they're very useful with if statements so that is it for variables if you would like a copy of all this code i will copy and paste all of this to the comments section down below but yeah that is how variables work in python hey people what's going on it's bro hope you're doing well and in this video i'm going to explain multiple assignment in python so sit back relax and enjoy the show

17:50 well then since you clicked on this video i should probably explain what multiple assignment is now multiple assignment allows us to assign multiple variables at the same time using one line of code here's an example of us using standard assignment let's say we have a variable name and i will set this to a value of my name but you can use your name for this example let's say edge equals 21 and how about a variable called attractive i think i'm going to set this to true okay so we have a bunch of variables and then we can print the value of these variables with some print statements so let's print name age and attractive so we have name age attractive and as you would expect this prints bro

18:37 21 and true now another way in which we could write the same code is to use multiple assignment and this allows us to assign multiple variables at the same time using one line of code so i'm going to turn all of these lines into comments and this time we will only use one line of code but to do this we're going to list all of our variables separated with a comma so that would be name comma edge comma attractive and we will set them equal to those values but in the same order separated by commas so that would be bro comma 21 comma true and this would do the same thing only using one line of code here's another example let's say we have four variables

19:22 spongebob patrick sandy and squidward and let's pretend that they're all around maybe 30 years old at least it seems like they're around 30 years old but i could be wrong i'm not too familiar with spongebob lore so let's set them all equal to 30. now we could write this using four lines of code or we could use multiple assignment to write the same thing using one line of code so if all of these variables are all equal to the same value there's a little bit of different syntax here so let's begin with the first variable of spongebob equals patrick equals sandy equals squidward then we're going to set them all equal to 30 and

20:09 this should work just fine using only one line of code well everybody that's pretty much it for multiple assignment it allows us to assign multiple variables at the same time using one line of code i will post all of this code in the comments section down below and well yeah that's how multiple assignment works in python hey what's going on everybody it's bro hope you're doing well and in this video i'm going to demonstrate some useful string methods in python so sit back relax and enjoy the show all right let's do this in this video i'm going to be explaining and demonstrating a few useful methods available to us for strings now let's create a variable called name for this example and you can use your own name if you want so we now have a variable called name

20:54 and for my first example let's print the length of our name variable so to do that we can surround our name variable with the length method and this will print and return how long the length of our string is and for me the length of my name variable is three for three characters if i were to increase the size of my name well then that's going to change to a so that is the length method and i'm just going to turn this line into a comment and let's move on so next we have the find method i just copy and pasted print name so i can reuse it name dot and actually if you have intellisense setup if you add dot after your variable you'll get a suggestion or a few suggestions of

21:40 different methods and other features that you have access to so let's find find which is uh screw this i'll just type find find then we can find the first index of where this character is let's say i would like to find where capital b is well that is at index zero because computers always start with zero so this first character would be zero then r would be one and then o would be two for this example all right so that is how to find a character within a string moving on so let's capitalize our name and i should probably make this lowercase so name dot capitalize

22:26 and this will make my name capitalized but if there's any spaces and then additional words it's not going to capitalize that only the first letter and your string next we have upper this will make your string all uppercase name upper and now it is uppercase guess what's next lower name dot lower and i should probably make this capital again and everything is lowercase we're making some good progress today next we have is digit this will return true or false depending on if our string is a digit which it's not so this will print false

23:14 if i changed my string to a bunch of numbers like 1 2 3 then this will return true let's change that back and move on next we have is alpha are these alphabetical characters oh make sure you add the parentheses afterwards my bad false because we added a space within here now it's true so you can use is alpha to check to see if your string contains only letters alphabetical letters next we have count we can count how many characters are within our string i would like to count how many o's are

24:00 in here and this should return two that's right okay we're almost at the end we can replace characters within our string so we use the replace method and we pass in two arguments the character we would like to replace and the character we would like to replace our character with i would like to change all o's to a's and now my name is brock hod oh you guys are gonna like this next one this isn't technically a method but it's a really neat feature so one thing that we can do that's available to us with python is that we can display a string multiple times by multiplying that string by a given number so let's say i would like to display my name three times i can just take my

24:46 string variable then add times three and this will print my name three times bro bro bro like i said not technically a method but it's a useful feature that you might be interested in that's related all right everybody so that is a few useful methods available to us for strings if you would like a copy of all this code i will post this in the comments section down below but yeah those are a few useful methods available to us for strings hey what's going on everybody it's you bro hope you're doing well and in this video i'm going to teach you guys all about typecasting in python so sit back relax and enjoy the show all right welcome back everybody i have a super quick video for you guys today on the subject of typecasting now typecasting is the ability to convert

25:32 the data type of a value to another data type here's an example that i've written already i'm just going to paste it i have three variables for this example x y and z x contains one this is a whole integer into for short y contains two point zero this is a floating point number float four short you can tell it's a float because it ends with a decimal portion and z contains a string of three a string is a series of characters and you can tell it's a string because it's surrounded with a set of quotes and remember with strings we cannot normally perform math on strings so i have three print statements for x y and z and as you would expect they contain the values of one two point zero and three now let's begin by converting both y

26:18 and z to the integer data type via typecasting in order to perform typecasting on a value or variable type that value or variable and surround this with a set of parentheses whoops i missed and then pre-save this with the data type you'd like to convert this value or variable to i would like to convert y to an integer and then you can use this for whatever you need so i'm going to replace y within my print statement with y after we typecast it as an integer and this will display 1 2 not 2.0 it's the whole integer of 2 and then 3. so this is not a permanent change if you need to make this as a permanent change to y you'd have to reassign it so let's say y

27:05 equals y and then we're going to typecast y so let's round this with a set of parentheses and precede this with the data type we'd like to convert y2 so now y is a whole integer and then we will print y without typecast this time and our result is one two three now z z is storing a string and with strings we cannot normally perform any math on strings for example within my print statement i will state z times three you would think that the result would be nine right well you're wrong it's going to print three three times if you need to convert a string to a int or a float you would just have to typecast it so this time let's type cast

27:50 z as an integer z int and we will type cast z as an integer so then if we have z times three the result is now 9 instead of 333 so that's the basic formula for type casting now let's convert these to floating point numbers but let's include x as well because x is feeling left out so let's convert x to a floating point number so float parenthesis and we will surround this with x and display x and actually let's convert y and z to floats as well because why not the results are now 1.0 2.0 and 9.0 remember that we multiplied z times

28:35 three and then if we need to convert these values to a string we would use the string cast so the results now are 1 2.0 and 333 now you might be thinking to yourself when would you need to convert an integer or a float to a string here's a situation let's say within our print statements we need to print these variables along with another string so within our print statement let's say x is plus x we would like to display these together and let me copy this and do the same thing for y we'll say y is plus y you cannot normally display a string

29:21 along with an integer or a float because we're using some string concatenation so this will result in a compilation error can only concatenate string not int to string so that's a situation in which you might need to use typecasting to convert an integer or float to a string so let's display x and y as strings via typecasting so we'll surround x and y with a set of parentheses and precede this with the data type we'd like to convert these values to we would like to convert x and y to both strings and now this will compile and run just fine well everybody that's the basics of typecasting if you would like a copy of all my code i will post everything in the comments down below if you found this video helpful don't be

30:06 afraid to help me out by smashing that like button drop a comment down below and subscribe if you'd like to become a fellow bro hey what's going on everybody it's bro hope you're doing well and in this video i'm going to teach you guys how we can accept some user input in python so sit back relax and enjoy the show ladies and gentlemen this is where the fun begins in this video i'm going to explain how we can accept some user input in python and we do so by using the input function and then we type in our input to the console window but it would probably be good practice to let the user know what we want them to type in exactly so let's ask for somebody's name within quotes inside the input function i'm going to type what is your name and now

30:52 our program will wait for us to enter in some user input so you can use your own name for this example i'm going to type bro now to submit some user input you just type or press enter now you can see that my process finished with exit code zero that means the program is done running so we should probably do something with this value we can actually assign it to a variable so we can use it elsewhere in our program so to do so we precede input with a variable like name works name equals input and when we accept some user input we will assign it to this variable that we called them and now we can do something with it so let's print a message involving our name variable that we have so how about hello plus name now when i run this program we can accept some user input

31:38 and then do something with that input such as display message that says hello bro and then you can type in whatever you want for your name let's say i'm dude what is your name dude hello dude now this next part is very important when we accept user input it is always of the string data type a series of characters what if we need to accept a number well you can but you can't normally perform any math on it because it's of the string data type we would need to cast it as either of the integer data type or of the float data type so here's an example of why we can't perform any math on a string let's say we have a variable called edge age equals input and let's ask how old somebody is how old

32:23 are you now i will add one to somebody's age let's pretend it's their birthday age equals age plus one this will add one to their age now let's try and run this what is your name bro how old are you let's say that i'm 21. okay we ran into an error a type error can only concatenate string to string with what i mentioned previously we cannot normally use strings for any sort of mathematical equation or operation we'll want to cast it to the integer or the float data type so let's cast our user input to the integer data type and we will surround our user input with a cast surround your input with a set of parenthesis and precede this with int and now we can use this user input

33:11 in a mathematical operation so let's try it even though this won't display age yet so what is your name bro 21 and our program finished with an x a code of zero there were no problems now let's attempt to display this edge so i will print u r plus age plus years old we're doing some string concatenation here what is your name bro how old are you 21 all right we ran into a type error again can only concatenate string to string you cannot normally display a variable of the integer data type along with strings because we're doing string concatenation we're adding strings together

33:57 we would need to convert this variable back to the string data type so we can cast it we'll surround our edge variable with a cast now this is what's going to happen we will accept some user input it will be of the string data type and then we will immediately cast it to be of the integer data type so that we can treat it as a number instead of a character and then if we need to display this edge we will need to convert it back to a string so that we can use some string concatenation and display all of these strings together and now let's try this theory so what is your name bro how old are you let's say i'm 21 hello bro you are 22 years old here's a situation what if we enter a number that contains a decimal portion so let's try this again let's say i'm 21.5 years old

34:44 well now we ran into a different issue a value error invalid literal for int with base 10 that means if we cast a string as an integer it can only be a whole number a portion that does not contain a decimal and that is where the float data type would come in it is a data type that can contain a decimal portion for this example let's create a third variable called height and we will ask for somebody's height input we'll create a prompt that says how tall are you and we will cast this to be of the float data type so that our string our user input can contain a decimal portion and then

35:31 we can treat it as a number instead of a series of characters and i think i will delete this line we won't really need it anymore and then let's print their height along with a message u r plus then height but we need to cast this back to being a string so we'll surround our height with a cast plus let's say cm tall all right let's test this what is your name bro how old are you let's say i'm 21 how tall are you let's pretend that i'm 250.5 centimeters tall i'm adding the 0.5 just to test to see if this will accept a floating point number

36:17 hello bro you are 21 years old you are 250.5 centimeters tall not really all right everybody so that is the basics of user input in python normally with user input it will give you a value of the string data type if you need to use that value for any sort of math you'll probably need to cast it to be of the integer or the float data type so if you would like a copy of this code i will post this in the comment section down below but yeah that's how to accept user input in python hey what's going on everybody it's bro hope you're doing well and in this video i'm going to demonstrate a few useful functions related to numbers in python so sit back relax and enjoy the show

37:03 okay let's begin in this video i'm going to be demonstrating a bunch of useful functions related to numbers and a bunch of these functions are located within the math module now let's create a variable for this example let's say pi equals 3.14 just the first few digits of pi is fine for this example and now here's a bunch of useful functions that you guys would probably be interested in the first is round round is a built-in function and all we do is type round then add a set of parenthesis and then we can pass in a value or a variable as an argument and the round function will round that number for us so pi rounded to the nearest whole integer is you guessed it three now we can round

37:48 a number up by using the seal function of the math class seal short for ceiling so let's print our result and in order to access this function within the math module we would type the name of the module dot and here's a bunch of functions that we have access to so we are looking for seal and it's actually at the top here for me and at seal we'll round a number up to the nearest whole integer so pi rounded up is four then on the flip side we can round a number down by using floor and that is also located within the math module so let's type math dot floor and pi rounded down would be three up next i have the absolute value function but it's abs

38:33 for short abs will give you the absolute value of a number so the absolute value of pi actually let's make this negative 3.14 the absolute value will tell you how far a number is away from zero so if you pass in a negative number it will give you a positive number so that is abs short for absolute value next we have the pow function pow will raise a base number to a power let's raise pi to the power of two so we pass in two arguments a base and an exponent pi to the power of two is nine point eight and some change so that is the pow function next we have square root

39:20 so this is located within the math module we'll type math dot s q r t short for square root and the square root of pi is let's find out oh i guess we can't pass in pi uh let's round a different number like 420 oh i guess that's because i made pi negative okay so the square root of 420 is 20.4 and some change so that is the square root function all right we have two left we have the max function the max function will find the largest of a varying amount of values so let's create three variables for this example let's say x equals one y equals two and z equals three we can use the max

40:07 function to find the largest of these values so within a print statement let's use the max function and pass in all of the different values or variables that you would like to compare so i would like to find the largest value between x y and z and the result in this example is three now the min function will find the lowest so min and then pass in your values or variables so i would like to find the minimum value between x y and z and in this case it is one well everybody those are a few useful functions that you guys might be interested in if you guys would like a copy of this code i will post this in the comments section down below

40:52 but yeah those are a few useful functions related to numbers in python hey what's going on everybody it's bro hope you're doing well and in this video i'm going to explain string slicing in python so sit back relax and enjoy the show all right then let's talk about slicing slicing can be used to create a substring by extracting elements from another string the same principle can also be applied to different collections as well but in this video we're going to be focusing on slicing strings now to slice a string we can either use the indexing operator which is a set of square brackets or by use of the slice function to create a slice object this is a little more complex we'll discuss the slice function near

41:38 the end of this video so with slicing there are three optional arguments three fields that we can fill in depending on where and how we want to slice our string a starting index a stopping index and a step let's begin with the starting index now for this example let's say we have a string variable called name and this will store a value of whatever your own full name is yes i legally change my name to bro code you can use your own name for this if you want so what i would like to do is to create a substring based off a sliced portion of my full name so what i would like to do is create a substring based off of just the first part of my name just bro so let's begin by creating a substring

42:23 maybe i'll call this first name equals now to slice a string type in a string or the name of a variable that contains your string and follow this with the indexing operator and like i said we'll discuss the slice function a little bit later so we need a starting index and a stopping index but we'll begin with the starting index where do we want to begin our slice so computers they always start with zero so the first character in your string will have an index of zero i would like my slice to begin at index 0 so i'll list that for the starting position the starting index so let's test this just to be sure it works i'll just print first name and let's see if this prints

43:10 capital b which it does so following that same pattern the next character within my string would have an index of one that would be r then the next index two would be o and three should be an empty space all right so that is the starting index within string slicing if we would like to slice an entire portion of our string not just one letter we need a stopping index as well and both of these fields are separated with a colon so let's say i would like to slice the first three characters of my string so this would have an index of zero one two and this isn't going to work as you would imagine and i'll explain why so you would think that indexes

43:57 0 through 2 would give us three letters right but it only gives us two so this first index is inclusive the stopping index is exclusive so if i want the first three characters the first three letters in the string i would need the starting index to be zero and the stopping index to be three and now this should print my first name and not anything else there is a shorthand way of writing this too so if you were to leave this first index blank for start well python is going to assume that this is zero the beginning of your string so this would be no different than what we had previously just having colon three now let's try and create a separate substring for a last name so last

44:45 name name now we need a starting index and a stopping index so we need the starting index at least so this would be zero one two three four four colon and where do we want this to stop zero one two three four five six seven and remember that this is exclusive so we're going to place eight here and now i would like to display last name and this should just display code and a shortcut is that if you were to leave stop blank but you still have that colon this is a shorthand way of writing i would like every character starting at index four and everything after until the end so

45:30 there would be no change to this as well you can write it either way okay so we still have to discuss step step is an optional field that we can set a value to so step is how much we're increasing our index by between starting and stopping so it is entirely possible to create a substring that will count only every second character after the first normally step is one by default but if we were to set that to two we're going to count only every second character so let's try this maybe i'll create a new variable called funky name because i really don't know what else to call this for this example let's say funky name equals name and i'm going to count only every second character including the first so the indexes would be zero colon

46:18 eight for my example but if you're using your own name that's probably going to be something different so the default first step is one and if i were to display funky name as it is currently this will just display my full name but if we set step to two this will only display every second character including the first so funky name is now for me at least b o c d now if step was three this will print only every third character including the first where it's b space d a shorthand way of writing this is that you could leave start and stop empty but the important thing is to have these two colons python is going to assume that if you leave your starting index empty you're referring to index 0 the

47:03 beginning if your second index your stopping index is empty python will assume this will be the very end of your string so just having two colons and then step three would be no different than what we had previously or this next part i'm going to explain how we can reverse a string in python so let's create a new substring variable called reversed name equals name i would like to use the entire string so i can just use two colons python will fill in the rest so for the step this is going to be negative one it's kind of like we're counting backwards and we're going to create a new sub string based off my name but in reverse so if i were to print my reversed name this is now edok orb i think that's how you

47:50 pronounce it so that's how to reverse a string in python using slicing now let's move on to part two of this video i'm going to be explaining the slice function and we can use the slice function to create a slice object which is actually reusable so that's somewhat convenient let's take a different scenario this time let's say we have a website url website equals http colon2forwardslashes google.com but use whatever website you want what i would like to do for this program is remove and create a substring based off the website name and not anything else i would like to exclude the http portion as well as the dot-com portion of this website url so let's break it down step by step our first step is to create a slice

48:37 object so i will name the slice object as slice slice equals and i will invoke the slice function so within the parentheses of the slice function we can add up to three values a start a stop and a step exactly the same as what we did with indexing however with the slice function we separate each of these values with a comma instead of a colon but it works the same way so we would like our substring to begin where the name of the website begins so we would like our start to be zero one two three four five six seven so i will pass in seven for where my substring will begin and now each value within the slice function will be separated with a comma instead of a colon like what we

49:23 did with the indexing operator now for the stop index that's going to be a little bit tricky and let me explain why one issue that we're going to run into is that not all website names are consistent with their length they can really vary so it is not possible for us to use the same stopping index for each of these website urls so one way in which we can account for that is to use what is called a negative index each character within a string has a positive index as well as a negative index and a negative index works almost exactly the same way except the character most on the right begins with a negative index of minus one and the character on the left of that would be negative two negative

50:09 three and negative four it's as if you're counting backwards so with indexing we can use some combination of positive and negative indexing so i would like my substring to end where this dot is so this would have a index of minus one minus two minus three minus four and remember that this is exclusive so i would like my slice to begin at index seven and a negative index of four for the stopping position so that will give me just the website name and remove the http portion as well as the dot com portion of my website url and now we have a slice object and we can reuse this so to apply your slice object type in the name your string

50:54 index operator and place your slice right within here and let's print this so print our website and apply the slice to it and now this should give us just the website name and now let's test this with maybe another website i'll rename this as website one and let's create website2 and let's try a different website name for goodmeasure so let's try wikipedia so we can reuse our slice object and we will apply our slice to website two this time and this should remove the url portions http as well as com all right everybody so that is slicing strings in python you can either use the indexing operator or the slice function to create a slice

51:42 object if you would like a copy of all this code i will post all of this in the comments section down below but yeah that is how string slicing works in python hey what's going on people it's you bro hope you're doing well and in this video i'm going to explain if statements else if statements and else statements and python so sit back relax and enjoy the show all right people let's talk about if statements an if statement is a block of code that will execute only if its condition is true it's a very basic form of decision making with programming for this example let's create a prompt where we will ask a user for their age and depending on what their age is we will print a response so let's say age equals input and then

52:29 we will add a prompt how old are you now this will return a string so we should probably cast this as an integer data type so we now have a variable called age where we will accept some user input let's check somebody's age with a variety of if statements so let's check to see if somebody's age is greater than or equal to 18 so to create an if statement type if and then some sort of condition if age is greater than or equal to 18 to finish this if statement add a colon at the end now pay attention to this if i move down to the next line you'll notice that my cursor is now indented any indented code underneath an if statement is the block of code for that if statement so if this condition is true we will execute some

53:14 block of code if it's false we'll skip over it so if somebody's age is greater than or equal to 18 let's print you are an adult and let's try this program how old are you let's say i'm 21 so my condition when we get to the if statement is going to check to see if this condition is true if it is true we're going to execute this block of code if it's not we skip over it so how old are you let's say i'm 21 i'm going to hit enter and my if statement is true so we execute this block of code which prints you are an adult so what if this condition is false let's say i'm 12. well then we're just going to skip over this block of code and continue on with the rest of the program if you would like your program to take some other course of action

54:00 if this condition is false we can add an else statement so after the if statement add else make sure you get the indentation right you don't want this within the block of code for the if statement so if this condition is false we can take some other course of action so if somebody's age is less than 18 let's print you are a child so let's try this again i'm going to enter that i am 12 years old not really but let's just pretend i am so this will now print you are a child if this condition is false perform this block of code for the else statement so with if statements we can check more than one condition before reaching the

54:45 else statement by using an else if statement and we add that after an if statement so it's shortened to e l i f for else if so let's check to see if somebody's age is less than zero for some reason so let's print you haven't been born yet so with if statements we start at the top we first check the if statement if this is false we move down to the next statement to check then we check our else if statement if this is also false then we resort to the else statement the else statement is sort of like a last resort if all conditions evaluate to be false then we execute the else statement

55:31 so let's try this how old are you let's say i'm negative 1 years old you haven't been born yet so with if statements we always begin with an if statement and we check that condition if that condition evaluates to be false then we will skip this block of code and move down to the else if statement if there is one it's optional if this condition is also false then we will use our else statement as a last resort if there is one if there is no else statement then we just skip over all of this then and continue on with the rest of the program so you can add more than one else if statement so let's check something else let's check to see else if age is equal to 100 so if you need to check

56:17 to see if a value is equal to a particular value make sure you use double equal signs this is the comparison operator for equality if you use just one equal sign that's the assignment operator and python thinks you're attempting to set age equal to 100 so if you want to check to see if age is equal to 100 then use double equals so let's check to see if somebody's age is equal to 100 so let's print you are a century old now pay attention to this if i were to run this program how old are you let's say i'm 100. so this is printing you are an adult that's because we first check

57:03 our if statement and well we're 100 years old and 100 is greater than or equal to 18. so we print this block of code we execute this block of code and then we skip everything else even though age is equal to 100 within our else if statement so the order of your if statements does matter so let's change this around let's add this to the very beginning and this will be our if statement and we will set age is greater than or equal to 18 to be an else if statement so we're first going to check to see if age is equal to 100 if not we will check to see if age is greater than or equal to 18 and we just follow that order so let's try this again how old are you

57:48 i am 100 years old you are a century old so we first check our if statement if this condition is true we will execute this block of code if it's false we just go down the order till we reach our else statement well everybody that is the basics of if statements we have if statements else if statements and else statements so if you would like a copy of this code i will post this in the comments down below but yeah that is how if statements work in python hey what's going on everybody it's bro hope you're doing well in this video i'm going to explain logical operators in python so sit back relax and enjoy the show all right everybody let's talk about logical operators these are used to check if two or more

58:36 conditional statements are true so we'll be discussing the and as well as the or logical operators there's also a third one called not but that works a little bit different and i'll explain why so let's create a program to demonstrate this let's create a program where we will ask somebody for the temperature outside and then depending on the temperature if it falls within a certain range we will print a message so we'll need to use and as well as or logical operators to do this so here i have a prompt temp for temperature equals input what is the temperature outside so i'm going to cast this as an integer data type so what if we want to check to see if our temperature is within a certain range we can use the and logical operator to check two or more conditional statements this

59:21 is how we might do that let's check if temp is greater than or equal to zero zero degrees celsius and we can check another condition too if temp is less than or equal to 30 degrees celsius so we need to add a colon at the end to finish this if statement and let me just fix some of the spacing okay so with the and logical operator in order for this entire condition to be true both conditions must be true this needs to be true and this needs to be true so if our temperature is equal to or above 0 as well as being less than or equal to 30 that means our temperature falls within a certain range so let's

1:00:07 print a message such as the temperature is good today print go outside all right let's try it so what is the temperature outside let's say it's 20 degrees celsius well the temperature is good today go outside this condition is true 20 is greater than or equal to zero and temperature is less than or equal to 30. let's try a different temperature like negative 20 degrees celsius so it's really freaking cold outside right now as you can see nothing happened because our first condition was false our temperature is not greater than or equal to zero but our temperature is less than or

1:00:54 equal to 30 so our second condition is true but our first condition was false and in order for this entire statement to be true since we're using the and logical operator both conditions must be true in order for this statement to be true now let's discuss the or logical operator we can check to see if our temperature is below or above a certain range so let's write else if temp is less than zero or temp is greater than 30. so that means it's going to be either very cold outside or very hot outside so let's print a message the temperature is bad today

1:01:39 print stay inside all right let's try this again what is the temperature outside it is negative 20 degrees outside the temperature is bad today stay inside so with the orological operator as long as one of these conditions is true then the entire statement is true it doesn't matter if one of them is false as long as one of them is true then the entire statement is true last but not least we have the not logical operator this works a little bit different from the and as well as the or logical operator because we can check one or more conditional statements instead of two or more conditional statements so what the not logical operator will do is that it'll take a conditional statement if it's true

1:02:26 it's going to flip it to false if it's normally false it's going to flip it to true so for this example we have another way in which we could write this although it's a little more complex so if our statement is true what we can do is that we can flip it to false using the not logical operator if it's normally false we can change it to true so what we'll do is surround one or more conditional statements with a set of parentheses and precede everything within the parentheses with the not logical operator so if the statement is normally true it's going to become false using the not logical operator if it's normally false it's going to be true then let's do the same with the else if statement so surround one or more conditional statements with the not logical operator so now these roles are going to be kind of reversed so let's

1:03:12 try this again what is the temperature outside it is negative 20 degrees outside the temperature is good today go outside so what we should probably do is kind of reverse these rolls so i'm just going to swap everything within these if statements with each other and now this should work the same as it did before but we just wrote it a little bit different what is the temperature outside it is 15 degrees outside 15 degrees celsius the temperature is good today go outside so with the not logical operator you can surround one or more conditional statements with the not logical operator and what this will do is flip it from being false to true or from true to false well everybody that's the basics of logical operators in python if you would like a copy of all this code i will post

1:03:57 this in the comments down below but yeah that's the basics of logical operators in python hey what's going on everybody it's bro hope you're doing well and in this video i'm going to explain while loops in python so sit back relax and enjoy the show so while loops a while loop is a statement that will execute its block of code as long as its condition remains true later on in this video for this example we're going to create a program where we will prompt a user to enter their name if they attempt to skip that prompt then we will continually ask the user to enter their name and they can't continue on with the rest of the program until they do so the key thing to keep in mind with while loops is that you'll want some way to eventually escape the while loop if you

1:04:42 don't have any way to escape the while loop that's referred to as an infinite loop so let's create an example of an infinite loop because it's fun so to create a while loop type while and then some sort of condition so for our condition let's say while one is equal to one so this will always be true now what do we want to do when we execute this block of code let's print something print help i'm stuck in a loop all right so let's try this while one is equal to one print this statement and we will just continue on and on within this while loop because we have no way to escape this while loop so now let's use this concept and write a program where we will prompt a user to type in their name if they don't type in anything then we

1:05:29 will continue to prompt them to type in at least something so let's say name is equal to and then to just keep this blank we'll just set this to a set of quotes and then let's write a while loop here while name and let's check the length of name if the length of our name is equal to zero then we will ask the user to type in their name name equals input enter your name so then once we escape the while loop let's print something print hello plus name whoops hello plus name alright so when i run this we are giving the user a way to escape the while loop

1:06:14 they have to type in something for their name as long as the length of my name is equal to zero keep on printing this prompt enter your name so i'm just going to hit enter a bunch of times enter your name no enter your name no enter your name no so we are stuck within this loop until we enter something for our name so this time let me type in a name then hit enter so therefore our condition is now false the length of my name is now one two three so three is not equal to zero therefore our while statement our while loop is false and we continue on with the rest of the program there are a few variations in which you could write the same program so let's write this a different way what we could do is say name is equal to none while

1:07:00 not name and this will pretty much do the same thing it's just another way of writing this well everybody that's the basics of while loops a while loop is a statement that will execute its block of code as long as its condition remains true for our example we asked the user to type in their name if they were to leave it empty or blank we would keep on asking the user to type in their name so if you would like a copy of this code i will post this in the comments section down below but yeah that's the basics of while loops in python hey what's going on everybody it's bro hope you're doing well and in this video i'm going to explain for loops in python and at the end of this video we're going to create a countdown timer so sit back relax and enjoy the show all right guys and gals let's talk about

1:07:47 for loops a for loop is a statement that will execute its block of code a limited amount of times it's similar but different from a while loop because a while loop could iterate an unlimited or infinite amount of times depending on the condition a for loop will only iterate a limited amount of times and before we start executing its block of code we already know how many times we're going to repeat this block of code so for this example let's create a for loop that will simply count it to 10 and then we'll create a few more sophisticated examples so to create a for loop that will count up to 10 this is what we'll type four and then we need some sort of counter people usually either write index or they shorten it to just i i for index four i in and we can set a range range

1:08:34 ten so we will execute this for loop ten times and to finish this for loop just add a colon at the end so the next line or lines will be indented so that's the block of code for the for loop what do we want to do during each iteration let's just print what i is and let's take a look to see what would happen so we executed this for loop ten times except with computers computers always start with zero so when we said four i in range ten we're counting numbers zero through nine so it's as if this number is exclusive so there's two ways we can change this we could say range ten plus one or what i would do is say print i plus one so this will give us numbers one through ten so that's a for loop it will execute a limited amount of times

1:09:20 this time let's count a range between two numbers not necessarily 0 to 10 but something else so let's say 4i in range maybe the numbers 50 through 100 so within my range function i will pass in two numbers the first number will be the starting point and the second number is the ending point this first number is inclusive and the second number is exclusive so let's print this print whatever i is so this will count 50 through 99 actually if you wanted to include this last number since it's exclusive what we could do is just add one to the end so this would give us 50 through 100 except that this will iterate 51 times since we're counting 50. so you just have to pay attention to

1:10:05 your range and the numbers that it's counting now one thing that you can do with the range function is that you can add a third argument and this will function as the step how much you want to count up or down by so this time let's count up by two so i'll add comma two we're passing in a

…

Share

YouTube Video Summaries