فا

Explore.explore_title_paged

Public users codes are in this section. You can use these codes for learning or as a basic base for your code.

مرتب‌سازی دیتافریم با pandas

import pandas as pd
data = {'name': ['John', 'Doe', 'Jane', 'Smith'],
        'age': [25, 30, 18, 40 ...
See and Run

محاسبه مجموع ستون‌های DataFrame در pandas

import pandas as pd
data = {'name': ['John', 'Doe', 'Jane', 'Smith'],
        'age': [25, 30, 18, 40 ...
See and Run

code 5693

<?php

if(isset($_FILES["fileToUpload"])) {
    $target_dir = "uploads/";
    $target_file = $target ...
See and Run

code 5387

# Mehdi Ghulami
a=int(input("enter number"))
for i in range(1,a+1):
    for j in range(1,i+1):
  ...
See and Run

code 5294

# Function for nth Fibonacci number
nterms = int(input("How many terms? "))
# first two terms
n1, ...
See and Run

code 5179

n = 5

# upward pyramid
for i in range(n):
    for j in range(n - i - 1):
        print(' ', end='') ...
See and Run

code 4145

# A function that returns the 'year' value:
def myFunc(e):
   return e['year']

cars = [
  {'car': ' ...
See and Run

بین درسی

import re

emails =["support@backendbaz.ir",\
"mysite@you.me.net",\
"my-site@you-me.net",\
"mysite.o ...
See and Run

اعتبارسنجی شماره موبایل ایرانی با Regex

import re

txt = "09123456789"
isValid = re.search("^09[0-9]{9}$", txt)
if isValid:
   print("Valid" ...
See and Run

بین درسی

from math import sqrt
def is_prime(num):
   if num == 0 or num == 1:
      return False
   elif num  ...
See and Run

بین درسی

def is_prime(num):
   count = 0
   for i in range(1, num+1):
      if num % i == 0:
         count = ...
See and Run

فرمت‌بندی تاریخ با strftime

import datetime
date1 = datetime.datetime(2022, 1, 1, 12, 30, 0)
print(date1.strftime('%Y %m %d'))
# ...
See and Run

محاسبه اختلاف تاریخ با datetime

import datetime
date1 = datetime.datetime(2022, 1, 1, 12, 30, 0)
date2 = datetime.datetime(2021, 7,  ...
See and Run

جذر اعداد با NumPy

import numpy as np
ar = np.array([[1, 2, 3], [4, 5, 6]])
print(np.sqrt(ar)) ...
See and Run

بین درسی

# لیست اولیه
mylist = ['4533-ali', '8642-maryam', '1298-mohammad', '3287-mahsa']
  
# تعداد کارکتری  ...
See and Run

بین درسی

# لیست اولیه
mylist = ['4533-ali', '8642-maryam', '1298-mohammad', '3287-mahsa']
  
# تعداد کارکتری  ...
See and Run

تبدیل لیست به رشته با reduce

from functools import reduce
s = ['I', 'have', 4, 'apples', 'and', 18, 'bananas']
 
listToStr = redu ...
See and Run

تبدیل لیست به رشته در پایتون - روش 2

def convertListToString(myList):
    return " ".join(myList)

print(convertListToString(['I', 'love' ...
See and Run

بین درسی

#include <iostream>
using namespace std;

int main() {
  try {
     int age = 15;
     if (age > 18) ...
See and Run

متغیر ثابت در ++C

#include <iostream>
using namespace std;

int main() {
  const int myNum = 15;  // myNum همیشه برابر ...
See and Run

بین درسی

public class MyClass {
  //متد جمع
  static void sum(int[] numbers) {
    int s = 0;
    for (int i  ...
See and Run

بین درسی

public class Main {
  public static void main(String[] args) {
    int[][] myNumbers = { {1, 2, 3, 4 ...
See and Run

بین درسی

public class MyClass {
  public static void main(String[] args) {
    int level = 4;
    switch (lev ...
See and Run

بین درسی

public class MyClass {
  public static void main(String[] args) {
    String firstName = "John ";
   ...
See and Run