This media is not supported in your browser
VIEW IN TELEGRAM
سورس کد
@raspberry_python
import turtle
col=('yellow','red','green','orange','blue','white')
t=turtle.Turtle()
screen=turtle.Screen()
screen.bgcolor('black')
t.speed(30)
for i in range (150):
t.color(col[i%6])
t.forward(i*4)
t.left(150)
t.width(2)
@raspberry_python
Built in class Attributes
https://www.instagram.com/p/CTLzAcMjNrk/?utm_medium=copy_link
@raspberry_python
https://www.instagram.com/p/CTLzAcMjNrk/?utm_medium=copy_link
@raspberry_python
NumPy views: saving memory, leaking memory, and subtle bugs
https://pythonspeed.com/articles/numpy-memory-views/
@raspberry_python
https://pythonspeed.com/articles/numpy-memory-views/
@raspberry_python
Forwarded from Persian python
سلام
اولین ویدیو یوتیوب آپلود شد
موضوع درمورد ورژن جدید پایتون هستش و 3 مثال درمورد match case که به صورت کامل توضیح دادم
لطفا اگر نظری دارید کامنت کنید ممنون
https://www.youtube.com/watch?v=swp0Ypkpkwo
اولین ویدیو یوتیوب آپلود شد
موضوع درمورد ورژن جدید پایتون هستش و 3 مثال درمورد match case که به صورت کامل توضیح دادم
لطفا اگر نظری دارید کامنت کنید ممنون
https://www.youtube.com/watch?v=swp0Ypkpkwo
YouTube
پایتون 3.10 همراه با Match Case !
سلام پایتون ورژن جدیدش بصورت بتا منتشر شده
یکی از ویژگی های جدید این نسخه (match case )عه
که خیلی شبیه به switch case هستش
سعی کردم که کامل توضیح بدم با 3 مثال
ممنون از اینکه مارو همراهی میکنید.
لینک گروه تلگرام برای سوالات پایتون :
https://t.me/python_QA…
یکی از ویژگی های جدید این نسخه (match case )عه
که خیلی شبیه به switch case هستش
سعی کردم که کامل توضیح بدم با 3 مثال
ممنون از اینکه مارو همراهی میکنید.
لینک گروه تلگرام برای سوالات پایتون :
https://t.me/python_QA…
Self-Organizing Maps: Theory and Implementation in Python with NumPy
https://stackabuse.com/self-organizing-maps-theory-and-implementation-in-python-with-numpy/
🌹 @raspberry_python
https://stackabuse.com/self-organizing-maps-theory-and-implementation-in-python-with-numpy/
🌹 @raspberry_python
اگه به برنامه نویسی
و طراحی گرافیک علاقه داری
یه سر به کانال یوتیوبم بزن.
آموزش رایگان 👇👇👇
برنامه نویسی و طراحی گرافیک
لینک زیر رو لمس کن آموزش رو شروع کن
https://www.youtube.com/channel/UCQLmSPBst-kkxCjO6GKihqw?sub_confirmation=1
و طراحی گرافیک علاقه داری
یه سر به کانال یوتیوبم بزن.
آموزش رایگان 👇👇👇
برنامه نویسی و طراحی گرافیک
لینک زیر رو لمس کن آموزش رو شروع کن
https://www.youtube.com/channel/UCQLmSPBst-kkxCjO6GKihqw?sub_confirmation=1
How to add an Element to a Set in Python
https://www.pythonforbeginners.com/basics/how-to-add-an-element-to-a-set-in-python
@raspberry_python
https://www.pythonforbeginners.com/basics/how-to-add-an-element-to-a-set-in-python
@raspberry_python
💻 Linear Algebra for Natural Language Processing
https://www.kdnuggets.com/2021/08/linear-algebra-natural-language-processing.html
Code: https://github.com/Taaniya/linear-algebra-for-ml
@raspberry_python
https://www.kdnuggets.com/2021/08/linear-algebra-natural-language-processing.html
Code: https://github.com/Taaniya/linear-algebra-for-ml
@raspberry_python
🐍 Python Program to Check If Two Strings are Anagram
https://www.programiz.com/python-programming/examples/anagram
@raspberry_python
https://www.programiz.com/python-programming/examples/anagram
@raspberry_python
📹 برخی سینتکسها، توابع، کلاسها، و لایبرریها در پایتون هستن که در کمتر نوشتن، و گاهی هم بهتر و بهینهتر نوشتن، به ما کمک میکنن. همچنین باعث میشن که در حین نوشتن یک برنامه، بیشتر درگیر چیزهای مهمتر بشیم و تک تک اجرای برنامه رو از اول ننویسیم. در عوض از چیزهای آماده، کار شده، بهینه شده و تست شده استفاده کنیم. شاید کار جالبی نباشه، اما بذارید با عنوان «تکخطی نویسی» شروع کنیم تا به کمتر و بهتر نوشتن قانع بشیم!
🎞 در اینجا، عناوین مرتبط رو از ۰ تا ۱۰۰ و از ساده به سخت بررسی میکنیم:
🔗 https://vrgl.ir/DOZCs
🆔 @raspberry_python
🎞 در اینجا، عناوین مرتبط رو از ۰ تا ۱۰۰ و از ساده به سخت بررسی میکنیم:
🔗 https://vrgl.ir/DOZCs
🆔 @raspberry_python
ویرگول
تکخطی نویسی در پایتون - بهینگی، پیچیدگی، تفریح!
قراره سینتکسها، built-inها و لایبرریهایی که در کمتر نوشتن، و گاهی هم بهتر و بهینهتر نوشتن کمک میکنن رو معرفی و بررسی کنیم، از ۰ تا ۱۰۰…
Python Program to Illustrate Different Set Operations
https://www.programiz.com/python-programming/examples/set-operation
@raspberry_python
https://www.programiz.com/python-programming/examples/set-operation
@raspberry_python
برای دوستانی که میخواهند چشم اندازی جهت حفظ سرمایه داشته باشند.
تهیه شده توسط تیم اقتصادی
قیمت ها طی ده سال گذشته از بهار 1390 تا بهار 1400
🟢 شاخص کل بورس 48 برابر
🟢 ارزش کل بازار سرمایه 44 برابر
🟢 سود خالص شرکت ها 36 برابر
🟢 سکه
🟢 رمز ارز
🟢 دلار بازار آزاد 21 برابر
🟢 طلا 21 برابر
🟢 مسکن 16 برابر
@raspberry_python
تهیه شده توسط تیم اقتصادی
قیمت ها طی ده سال گذشته از بهار 1390 تا بهار 1400
🟢 شاخص کل بورس 48 برابر
🟢 ارزش کل بازار سرمایه 44 برابر
🟢 سود خالص شرکت ها 36 برابر
🟢 سکه
🟢 رمز ارز
🟢 دلار بازار آزاد 21 برابر
🟢 طلا 21 برابر
🟢 مسکن 16 برابر
@raspberry_python
♦️♦️♦️ Doreamon using Python Turtle ♦️♦️♦️
Source code like
👇👇👇👇
https://github.com/PerpetualSmile/Python-Painting-Doraemon/blob/master/Doraemon.py
@raspberry_python
Source code like
👇👇👇👇
https://github.com/PerpetualSmile/Python-Painting-Doraemon/blob/master/Doraemon.py
@raspberry_python
GitHub
Python-Painting-Doraemon/Doraemon.py at master · PerpetualSmile/Python-Painting-Doraemon
使用python的turtle库绘制哆啦A梦. Contribute to PerpetualSmile/Python-Painting-Doraemon development by creating an account on GitHub.
Python learning:
# Source Code
import pygame
import time
import random
snake_speed = 15
# Window size
window_x = 720
window_y = 480
# defining colors
black = pygame.Color(0, 0, 0)
white = pygame.Color(255, 255, 255)
red = pygame.Color(255, 0, 0)
green = pygame.Color(0, 255, 0)
blue = pygame.Color(0, 0, 255)
# Initialising pygame
pygame.init()
# Initialise game window
pygame.display.set_caption('Snakes Master')
game_window = pygame.display.set_mode((window_x, window_y))
# FPS (frames per second) controller
fps = pygame.time.Clock()
# defining snake default position
snake_position = [100, 50]
# defining first 4 blocks of snake body
snake_body = [[100, 50],
[90, 50],
[80, 50],
[70, 50]
]
# fruit posiiton
fruit_position = [random.randrange(1, (window_x//10)) * 10,
random.randrange(1, (window_y//10)) * 10]
fruit_spawn = True
# setting default snake direction towards
# right
direction = 'RIGHT'
change_to = direction
# inital score
score = 0
# displaying Score function
def show_score(choice, color, font, size):
# creating font object score_font
score_font = pygame.font.SysFont(font, size)
# create the display surface object
# score_surface
score_surface = score_font.render('Score : ' + str(score), True, color)
# create a rectangular object for the text
# surface object
score_rect = score_surface.get_rect()
# displaying text
game_window.blit(score_surface, score_rect)
# game over function
def game_over():
# creating font object my_font
my_font = pygame.font.SysFont('times new roman', 50)
# creating a text surface on which text
# will be drawn
game_over_surface = my_font.render(
'Your Score is : ' + str(score), True, red)
# create a rectangular object for the text
# surface object
game_over_rect = game_over_surface.get_rect()
# setting position of the text
game_over_rect.midtop = (window_x/2, window_y/4)
# blit wil draw the text on screen
game_window.blit(game_over_surface, game_over_rect)
pygame.display.flip()
# after 2 seconds we will quit the program
time.sleep(2)
# deactivating pygame library
pygame.quit()
# quit the program
quit()
# Main Function
while True:
# handling key events
for event in pygame.event.get():
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_UP:
change_to = 'UP'
if event.key == pygame.K_DOWN:
change_to = 'DOWN'
if event.key == pygame.K_LEFT:
change_to = 'LEFT'
if event.key == pygame.K_RIGHT:
change_to = 'RIGHT'
# If two keys pressed simultaneously
# we don't want snake to move into two
# directions simultaneously
if change_to == 'UP' and direction != 'DOWN':
direction = 'UP'
if change_to == 'DOWN' and direction != 'UP':
direction = 'DOWN'
if change_to == 'LEFT' and direction != 'RIGHT':
direction = 'LEFT'
if change_to == 'RIGHT' and direction != 'LEFT':
direction = 'RIGHT'
# Moving the snake
if direction == 'UP':
snake_position[1] -= 10
if direction == 'DOWN':
snake_position[1] += 10
if direction == 'LEFT':
snake_position[0] -= 10
if direction == 'RIGHT':
snake_position[0] += 10
# Snake body growing mechanism
# if fruits and snakes collide then scores
# will be incremented by 10
snake_body.insert(0, list(snake_position))
if snake_position[0] == fruit_position[0] and snake_position[1] == fruit_position[1]:
score += 10
fruit_spawn = False
else:
snake_body.pop()
if not fruit_spawn:
fruit_position = [random.randrange(1, (window_x//10)) * 10,
random.randrange(1, (window_y//10)) * 10]
fruit_spawn = True
game_window.fill(white)
for pos in snake_body:
pygame.draw.rect(game_window, black,
# Source Code
import pygame
import time
import random
snake_speed = 15
# Window size
window_x = 720
window_y = 480
# defining colors
black = pygame.Color(0, 0, 0)
white = pygame.Color(255, 255, 255)
red = pygame.Color(255, 0, 0)
green = pygame.Color(0, 255, 0)
blue = pygame.Color(0, 0, 255)
# Initialising pygame
pygame.init()
# Initialise game window
pygame.display.set_caption('Snakes Master')
game_window = pygame.display.set_mode((window_x, window_y))
# FPS (frames per second) controller
fps = pygame.time.Clock()
# defining snake default position
snake_position = [100, 50]
# defining first 4 blocks of snake body
snake_body = [[100, 50],
[90, 50],
[80, 50],
[70, 50]
]
# fruit posiiton
fruit_position = [random.randrange(1, (window_x//10)) * 10,
random.randrange(1, (window_y//10)) * 10]
fruit_spawn = True
# setting default snake direction towards
# right
direction = 'RIGHT'
change_to = direction
# inital score
score = 0
# displaying Score function
def show_score(choice, color, font, size):
# creating font object score_font
score_font = pygame.font.SysFont(font, size)
# create the display surface object
# score_surface
score_surface = score_font.render('Score : ' + str(score), True, color)
# create a rectangular object for the text
# surface object
score_rect = score_surface.get_rect()
# displaying text
game_window.blit(score_surface, score_rect)
# game over function
def game_over():
# creating font object my_font
my_font = pygame.font.SysFont('times new roman', 50)
# creating a text surface on which text
# will be drawn
game_over_surface = my_font.render(
'Your Score is : ' + str(score), True, red)
# create a rectangular object for the text
# surface object
game_over_rect = game_over_surface.get_rect()
# setting position of the text
game_over_rect.midtop = (window_x/2, window_y/4)
# blit wil draw the text on screen
game_window.blit(game_over_surface, game_over_rect)
pygame.display.flip()
# after 2 seconds we will quit the program
time.sleep(2)
# deactivating pygame library
pygame.quit()
# quit the program
quit()
# Main Function
while True:
# handling key events
for event in pygame.event.get():
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_UP:
change_to = 'UP'
if event.key == pygame.K_DOWN:
change_to = 'DOWN'
if event.key == pygame.K_LEFT:
change_to = 'LEFT'
if event.key == pygame.K_RIGHT:
change_to = 'RIGHT'
# If two keys pressed simultaneously
# we don't want snake to move into two
# directions simultaneously
if change_to == 'UP' and direction != 'DOWN':
direction = 'UP'
if change_to == 'DOWN' and direction != 'UP':
direction = 'DOWN'
if change_to == 'LEFT' and direction != 'RIGHT':
direction = 'LEFT'
if change_to == 'RIGHT' and direction != 'LEFT':
direction = 'RIGHT'
# Moving the snake
if direction == 'UP':
snake_position[1] -= 10
if direction == 'DOWN':
snake_position[1] += 10
if direction == 'LEFT':
snake_position[0] -= 10
if direction == 'RIGHT':
snake_position[0] += 10
# Snake body growing mechanism
# if fruits and snakes collide then scores
# will be incremented by 10
snake_body.insert(0, list(snake_position))
if snake_position[0] == fruit_position[0] and snake_position[1] == fruit_position[1]:
score += 10
fruit_spawn = False
else:
snake_body.pop()
if not fruit_spawn:
fruit_position = [random.randrange(1, (window_x//10)) * 10,
random.randrange(1, (window_y//10)) * 10]
fruit_spawn = True
game_window.fill(white)
for pos in snake_body:
pygame.draw.rect(game_window, black,
pygame.Rect(pos[0], pos[1], 10, 10))
pygame.draw.rect(game_window, red, pygame.Rect(
fruit_position[0], fruit_position[1], 10, 10))
# Game Over conditions
if snake_position[0] < 0 or snake_position[0] > window_x-10:
game_over()
if snake_position[1] < 0 or snake_position[1] >
window_y-10:
game_over()
# Touching the snake body
for block in snake_body[1:]:
if snake_position[0] == block[0] and snake_position[1] == block[1]:
game_over()
# displaying score countinuously
show_score(1, black, 'times new roman', 20)
# Refresh game screen
pygame.display.update()
# Frame Per Second /Refres Rate
fps.tick(snake_speed)
@raspberry_python
pygame.draw.rect(game_window, red, pygame.Rect(
fruit_position[0], fruit_position[1], 10, 10))
# Game Over conditions
if snake_position[0] < 0 or snake_position[0] > window_x-10:
game_over()
if snake_position[1] < 0 or snake_position[1] >
window_y-10:
game_over()
# Touching the snake body
for block in snake_body[1:]:
if snake_position[0] == block[0] and snake_position[1] == block[1]:
game_over()
# displaying score countinuously
show_score(1, black, 'times new roman', 20)
# Refresh game screen
pygame.display.update()
# Frame Per Second /Refres Rate
fps.tick(snake_speed)
@raspberry_python
Django REST Framework and Elasticsearch
https://testdriven.io/blog/django-drf-elasticsearch/
@raspberry_python
https://testdriven.io/blog/django-drf-elasticsearch/
@raspberry_python