@PythonForYou - BOOK01.pdf
حجم:
11.95M
🐍 کتابهای زبان اصلی برای یادگیری پایتون | English Python Books
Python by Example - Learning to Program in 150 Challenges
💯 @PythonForYou 🧑💻👩💻
@PythonForYou - BOOK02.pdf
حجم:
3.14M
🐍 کتابهای زبان اصلی برای یادگیری پایتون | English Python Books
A Practical Introduction to Python Programming
💯 @PythonForYou 🧑💻👩💻
@PythonForYou - BOOK03.pdf
حجم:
2.54M
🐍 کتابهای زبان اصلی برای یادگیری پایتون | English Python Books
Python The Ultimate Beginner’s Guide!
💯 @PythonForYou 🧑💻👩💻
@PythonForYou - BOOK04.pdf
حجم:
11.63M
🐍 کتابهای زبان اصلی برای یادگیری پایتون | English Python Books
Python for Data Analysis
💯 @PythonForYou 🧑💻👩💻
@PythonForYou - BOOK05.pdf
حجم:
3.25M
🐍 کتابهای زبان اصلی برای یادگیری پایتون | English Python Books
A Python Book: Beginning Python, Advanced Python, and Python Exercises
💯 @PythonForYou 🧑💻👩💻
@PythonForYou - BOOK06.pdf
حجم:
12.07M
🐍 کتابهای زبان اصلی برای یادگیری پایتون | English Python Books
Fundamentals of Python Programming
💯 @PythonForYou 🧑💻👩💻
@PythonForYou - BOOK07.pdf
حجم:
7.5M
🐍 کتابهای زبان اصلی برای یادگیری پایتون | English Python Books
Python® Notes for Professionals
💯 @PythonForYou 🧑💻👩💻
@PythonForYou - BOOK08.pdf
حجم:
4.9M
🐍 کتابهای زبان اصلی برای یادگیری پایتون | English Python Books
Python’s Companion - The Most Complete Step-by-Step Guide to Python Programming
💯 @PythonForYou 🧑💻👩💻
🚩 چطور از این عکسا درست کنیم؟!
💠 وارد ChatGPT بشین و پرامپت زیر رو بهش بدین.
🔸 توی پرامپت باید مشخص کنین این عکسو واسه چه کشوری ایجاد کنه ؛)
A Close-Up Photograph Of A Large Map, All Landmarks Set On A Vintage (IRAN) Map Background Write The County Name With Capital Letters. As a Miniature 3D Landscape Is Sculpted Sand, Featuring Of Most Iconic And Famous Landmarks And Architectural From Same Country famous landmark (Azadi Tower ،Milad Tower)
• And 3D Tiny Small Autumn Trees And Leaves Surround The Landmarks, Creating A Surreal, Cozy, Atmosphere.
💯 @PythonForYou 🧑💻👩💻
پایتون برای شما
🧑💻👩💻 ۱۵ تمرین باحال برای تسلط بر رشتهها در پایتون! 🚀 برای اینکه حسابی روی رشتهها استاد بشید، ۱۵
خب بچههای باهوش دوره پایتون! 👋
اینجا پاسخهای ۱۵ تمرین رشتهها رو براتون آوردم تا اگه جایی گیر کردید، بتونید نگاهی بندازید. سعی کنید اول خودتون تمرینها رو حل کنید و فقط اگه لازم شد به این کدها نگاه کنید! 😎 هر کد با یه توضیح کوتاه و خروجی همراهه. بریم ببینیم!
🟢 تمرینهای سطح ساده (۱ تا ۵)
💯 بزرگ کردن حروف
رشته رو به حروف بزرگ تبدیل میکنیم:
text = "hello"
result = text.upper()
print(result) # Output: HELLO
------------------------------
💯 حذف فاصلههای اضافی
فاصلههای ابتدا و انتها رو حذف میکنیم:
text = " hi there "
result = text.strip()
print(result) # Output: hi there
------------------------------
💯 شمردن حرف خاص
تعداد حرف "a" رو میشمریم:
text = "banana"
count = text.count("a")
print(count) # Output: 3
------------------------------
💯 بررسی شروع رشته
چک میکنیم رشته با "Py" شروع میشه یا نه:
text = "Python is fun"
result = text.startswith("Py")
print(result) # Output: True
------------------------------
💯 جایگزینی کلمه
کلمه "coding" رو با "Python" عوض میکنیم:
text = "I like coding"
result = text.replace("coding", "Python")
print(result) # Output: I like Python
------------------------------
🟡 تمرینهای سطح متوسط (۶ تا ۱۰)
💯 برعکس کردن رشته
با برش (slicing) رشته رو برعکس میکنیم:
text = "Hello"
result = text[::-1]
print(result) # Output: olleH
------------------------------
💯 جدا کردن کلمات
جمله رو به لیست کلمات تبدیل میکنیم:
text = "Python is cool"
result = text.split()
print(result) # Output: ['Python', 'is', 'cool']
------------------------------
💯 چسبوندن کلمات
لیست رو با "/" به یه رشته تبدیل میکنیم:
parts = ["home", "user", "docs"]
result = "/".join(parts)
print(result) # Output: home/user/docs
------------------------------
💯 پیام خوشامدگویی
با متد format() پیام میسازیم:
name = "Alex"
age = 15
result = "Hi, I’m {} and I’m {} years old!".format(name, age)
print(result) # Output: Hi, I’m Alex and I’m 15 years old!
------------------------------
💯 بررسی نوع کاراکترها
چک میکنیم رشته فقط از حروف و اعداد تشکیل شده یا نه:
text = "Secure123"
result = text.isalnum()
print(result) # Output: True
------------------------------
🔴 تمرینهای سطح سخت (۱۱ تا ۱۵)
💯 شمردن کلمات خاص
تعداد کلمه "like" رو میشمریم:
sentence = "I like to code and I like to learn"
count = sentence.count("like")
print(count) # Output: 2
------------------------------
💯 فرمتبندی عنوان
فاصلههای اضافی رو حذف و حرف اول هر کلمه رو بزرگ میکنیم:
text = " learning python is fun "
result = text.strip().title()
print(result) # Output: Learning Python Is Fun
------------------------------
💯 جایگزینی و پیدا کردن
همه "hello"ها رو با "Hi" عوض میکنیم و جای اولین "Hi" رو پیدا میکنیم:
text = "Hello World, hello Python"
new_text = text.replace("hello", "Hi")
index = new_text.find("Hi")
print("رشته جدید:", new_text)
print("INDEX Hi:", index)
# Output: رشته جدید: Hi World, Hi Python
# INDEX Hi: 0
------------------------------
💯 اعتبارسنجی پیشرفته
چک میکنیم رشته با ".pdf" تموم میشه و بخش اصلیش (بدون پسوند) فقط حروف و اعداده یا نه:
filename = "document.pdf"
is_pdf = filename.endswith(".pdf")
base_name = filename[:-4] # حذف .pdf
is_alnum = base_name.isalnum()
print("PDF file and alphanumeric:", is_pdf and is_alnum)
# Output: PDF file and alphanumeric: False
------------------------------
💯 چک کردن پالیندروم
رشته رو کوچیک میکنیم و چک میکنیم آیا پالیندرومه:
text = "Radar"
normalized = text.lower()
is_palindrome = normalized == normalized[::-1]
print(is_palindrome) # Output: True
------------------------------
نکات مهم 💡
🔻 این کدها جوابهای ساده و مستقیمن. سعی کنید اول خودتون حل کنید و فقط برای چک کردن یا رفع اشکال بهشون نگاه کنید.
🔻 اگه خطایی گرفتید، متن خطا رو بخونید تا بفهمید مشکل کجاست.
🔻 میتونید کدها رو تغییر بدید یا با ورودیهای مختلف تست کنید.
🔻 اگه سوالی دارید یا جایی گیر کردید، بپرسید تا باهم حل کنیم! 😄
💯 @PythonForYou 🧑💻👩💻
2️⃣ مراقب اولویت عملگرها باش!
عملگرهای منطقی (and, or, not) اولویتهای متفاوتی دارن. and از or قویتره (اول اجرا میشه).
💥 ترفند: برای جلوگیری از اشتباه، همیشه از پرانتز () برای مشخص کردن ترتیب شرطها استفاده کن.
❌ مثال اشتباه:
if age > 18 and has_license or has_permit:
print("Mitoni ranandegi koni! 🚗")
❗️ اینجا ممکنه پایتون شرط رو اشتباه تفسیر کنه (چون and اول اجرا میشه).
✅ مثال درست:
if (age > 18 and has_license) or has_permit:
print("Mitoni ranandegi koni! 🚗")
💡 نکته: اگه شرط پیچیدهست، بهتره اونو به متغیرهای بولین جدا کنی:
can_drive = age > 18 and has_license
has_access = can_drive or has_permit
if has_access:
print("Mitoni ranandegi koni! 🚗")
💯 @PythonForYou 🧑💻👩💻
3️⃣ استفاده از عملگر in برای سادهسازی
به جای چندتا شرط با or, از عملگر in برای بررسی وجود یه مقدار تو لیست، رشته، یا دیکشنری استفاده کن.
❌ مثال طولانی:
fruit = "sib"
if fruit == "sib" or fruit == "moz" or fruit == "portoghal":
print("In mive to list hast! 🍎")
✅ مثال کوتاه با in:
fruit = "sib"
if fruit in ["sib", "moz", "portoghal"]:
print("In mive to list hast! 🍎")
💡 نکته:
- دقت کن که in برای رشتهها هم کار میکنه:
if "python" in "I love python programming":
print("Kalame python to jomle hast! 🐍")
- برای دیکشنری، in کلیدها رو چک میکنه:
user = {"name": "Ali", "age": 25}
if "name" in user:
print("Key name vojood dare! 🔑")
💯 @PythonForYou 🧑💻👩💻