TGViewer
Channel Public Channel
پایتون | Data Science | Machine Learning

پایتون | Data Science | Machine Learning

@python4all_pro

◀️اینجا با تمرین و چالش با هم پایتون رو یاد می گیریم

⏮بانک اطلاعاتی پایتون
پروژه / code/ cheat sheet
+ویدیوهای آموزشی

+کتابهای پایتون
تبلیغات:
@alloadv

🔁ادمین :
@maryam3771
Subscribers
24.2K
Photos
638
Videos
81
Links
504

Showing posts older than #357 · Back to latest

Older Posts 17 shown
Post #349 3.97K
Explanation:
Here, 'result' is a list which is extending three times. When first time 'extend' function is called for 'result', the inner code generates a generator object, which is further used in 'extend' function. This generator object contains the values which are in 'list1' only (not in 'list2' and 'list3').
Same is happening in second and third call of 'extend' function in these generator object contains values only in 'list2' and 'list3' respectively. So, 'result' variable will contain elements which are only in one list (not more than 1 list).


🆔 @Python4all_pro
  • 👍 3
Post #348 4.03K
  • 🆒 10
Post #347 3.92K
⁉️ تمرین  : به نظر شما گزینه درست کدومه ؟

#code #test

🆔 @Python4all_pro
Post #346 4.57K
Pattern 16

n = 7
for i in range(7):
print(" " * i, end="")
for j in range(1, 7-i+1):
print(j, end=" ")
print()



#code #pattern

🆔 @Python4all_pro
  • 👍 7
  • ❤‍🔥 2
Post #341 4.4K
Low Battery Notification

pip install psutil

import psutil

battery = psutil.sensors_battery()
plugged = battery.power_plugged
percent = battery.percent

if percent <= 30 and plugged!=True:
# pip install py-notifier
# pip install win10toast
from pynotifier import Notification

Notification(
title="Battery Low",
description=str(percent) + "% Battery remain!!",
duration=5, # Duration in seconds
).send()





#code

🆔 @Python4all_pro
  • 👍 9
Post #328 4.12K
🔅 Convert JPG to PNG
from PIL import Image

im = Image.open("naruto.jpg").convert("RGB")
im.save("naruto.png", "png")


🔅 Convert PNG to JPG
from PIL import Image

im = Image.open("naruto.png").convert("RGB")
im.save("naruto.jpg", "jpeg")


```install
pip install PIL `




#code

🆔 @Python4all_pro
  • 👍 2
Post #325 4.22K
5 Ways of Debugging with Python

یک مقاله عالی از Tenderlove - یکی از توسعه دهندگان اصلی Ruby و Rails - نکته اصلی این است که به شما نشان دهد که در بسیاری از موارد، شما به یک دیباگر کامل نیاز ندارید. اشکال زدایی که با یک IDE خوب همراه است یکی از قدرتمندترین ابزارهایی است که یک برنامه نویس می تواند داشته باشد! شما به راحتی می توانید breakpoints را در کد خود قرار دهید، یا متغیرها را در لحظه چک و تغییر دهید. کار با کدهای بزرگ را بسیار آسان‌تر می‌کند و به تازه‌واردها کمک می‌کند تا در پروژه‌های جدید با سرعت بیشتری عمل کنند

https://switowski.com/blog/ipython-debugging/


🆔 @Python4all_pro
Sebastian Witowski 5 Ways of Debugging with IPython Tips and tricks on how to use IPython as your debugger.
  • 👍 2
Post #321 3.56K
Pattern 15

n = 7
for i in range(n, 0, -1):
print(" " * i, end="")
for j in range(n-i+1):
print(i, end=" ")
print()



#code #pattern

🆔 @Python4all_pro
  • 👍 5
Post #319 3.35K
🔅 Extract the colors and their codes from an image

from PIL import Image
from collections import Counter

# https://t.me/LearnPython3

# Open the image
image = Image.open('input.png')

# Convert the image to a list of RGB tuples
pixels = list(image.getdata())

# Use Counter to count the occurrences of each color
color_counts = Counter(pixels)

# Get the 6 most common colors
top_colors = color_counts.most_common(6)

# Print the extracted colors and their counts
for i, (color, count) in enumerate(top_colors):
color_block = "\033[48;2;{};{};{}m \033[0m".format(color[0], color[1], color[2])
print(f"Color {i + 1}: {color_block} RGB: {color} - Count: {count}")




#code

🆔 @Python4all_pro
  • 👏 3
  • 👾 1
Post #318 3.2K
Extract the colors and their codes from an image


#code

🆔 @Python4all_pro
  • 👏 3
Post #310 3.87K
Quick Guide On #Pandas


#کتابخانه #علم_داده
#library

🆔 @Python4all_pro
  • ❤‍🔥 3
  • 🏆 1
Older posts →
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →