Public users codes are in this section. You can use these codes for learning or as a basic base for your code.
import tkinter as tk from tkinter import messagebox, ttk import matplotlib.pyplot as plt from matplo ...See and Run
ENGLISH_NUMBER_TO_PERSIAN = {
"0": "۰",
"1": "۱",
"2": "۲",
"3": "۳",
"4": "۴", ...See and Run# P = مبلغ واریز ماهانه (تومان) # R = نرخ سود سالانه (به درصد، مثلاً ۳۰) # n = تعداد سال (اینجا ۲۰) ...See and Run
<?php $a = 32; echo intval($a) . "<br>"; $b = 3.2; echo intval($b) . "<br>"; $c = "32.5"; echo int ...See and Run
import secrets
import string
def generate_password(length=12, min_digits=2, min_special=2):
...See and Run<?php
function printBoard($board) {
foreach ($board as $row) {
echo implode(' ', $row) ...See and Run# برنامه ای برای مرتب سازی یک دیکشنری در پایتون
# تعریف یک دیکشنری نمونه
my_dict = {"c": 3, "a": ...See and Run# برنامه ای برای محاسبه و نمایش جزء صحیح یک عدد # تعریف یک عدد اعشاری number = 12.34567 # روش اول: ...See and Run
# برنامه ای برای نمایش یک عدد تا دو رقم اعشار # تعریف یک عدد number = 12.34567 # روش اول: است ...See and Run
# برنامه ای برای محاسبه جمع اعداد از 1 تا 100 # استفاده از تابع sum و range برای محاسبه جمع total_s ...See and Run
fruits = 'apple and banana' char_to_find = 'a' index = 0 positions = [] while index < len(fruits): ...See and Run
#استخراج پسوند فایل با پیدا کردن موقعیت آخرین نقطه filename = "example.file.name.txt" #استفاده از مت ...See and Run
txt = """Welcome to backendbaz, where you can play and learn!""" #استفاده از متد splitlines x = txt. ...See and Run
#به دست آوردن ایندکس آخرین مکان پیدا شدن حرف e در متن txt = "Hello, welcome to my world." x = txt.rf ...See and Run
#تبدیل حرف اول تمام کلمات متن به حرف بزرگ و باقی حروف به حرف کوچک txt = "Welcome to my world" x = tx ...See and Run
a = hex(255) # 0xff b = hex(25) # 0x19 c = hex(0) # 0x0 d = hex(130) # 0x82 print(a, b, c, d) ...See and Run
#متد update
car = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
car.update({"color": ...See and Run<?php
$cities = array(
"Sari" => 17,
"Yazd" => 40,
"Tabriz" => -5,
"Ahvaz" => 27,
...See and Rundef print_odd_numbers(n):
if n < 0:
# برای اعداد منفی، از n تا -1 به عقب میرویم
...See and Runn = 100
sum1 = 0
for i in range(1, n + 1):
sum1 = sum1 + i ** 2
sum2 = 0
for i in range(1, ...See and Run#متد all #بررسی می کند که آیا تمام مقادیر، True هستند یا نه mylist = [True, True, True] print(all(my ...See and Run
<?php
class Person{
private $name;
public function setName(string $newName){
$t ...See and Run#مثال یک دیکشنری
my_dict = {'a': 1, 'b': 2, 'c': 3}
# تبدیل کلیدها به لیست
keys_list = list(my_dic ...See and Rundef reverse_string(input_string):
reversed_string = input_string[::-1]
return reversed_strin ...See and Run