فا

User codes archives - Page 3

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

Java String indexOf() Example: Find Substring Position

public class MyClass {
  public static void main(String[] args) {
    String txt = "Please locate wh ...
See and Run

Java String toUpperCase() and toLowerCase() Example

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

Python Falsy Values: Complete Guide

print(bool(False))
print(bool(None))
print(bool(0))
print(bool(""))
print(bool(()))
print(bool([]))
 ...
See and Run

Python Script to Calculate Student Average Grade

dorus = ["riazi", "adabiat", "varzesh", "farsi", "zist", "tarikh", "joghrafia"]

nomarat = {}

for d ...
See and Run

Calculate Average Grade with Course List in Python

dorus = ["riazi", "adabiat", "varzesh", "farsi", "zist", "tarikh", "joghrafia"]

nomarat = []

for d ...
See and Run

Python if-else Example: Check Average Score

avg = int(input("معدل خود را وارد کنید:\n "))
if avg > 10:
  print("شما قبول شده اید")
else:
  print ...
See and Run

Python if Statement: Pass/Fail Based on Average

avg = input("معدل خود را وارد کنید: \n")
avg = int(avg)
if avg > 10:
  print("شما قبول شده اید") ...
See and Run

Python Type Casting: Convert String to Integer with input()

age = input("Input your age:\n") #30
age = int(age)
print(age * 2) #60 ...
See and Run

Python Input and Output: Simple Guide

username = input("Enter username:\n")
print("Username is: ", username) ...
See and Run

PHP Static Method Example - Hello World

<?php
class ClassName {
  public static function staticMethod() {
    echo "Hello World!";
  }
}

Cl ...
See and Run

PHP Array Tutorial: Display Data with Nested Loops

<?php
$cars = array (
   array("Volvo",22,18),
   array("BMW",15,13),
   array("Saab",5,2),
   array ...
See and Run

PHP Beginner Example: Variables and Echo Output

<?php 
$txt = "Hello world!";
$x = 5;
$y = 10.5;

echo $txt."\n";
echo $x."\n";
echo $y."\n";
?> ...
See and Run

Python List Input and Print with Comma Separator

def inputlist (x , n ):
    for i in range (n):
        x.append(int ( input ("list"+str(i)+"=")))
  ...
See and Run

Python Operator Mapping with operator module Example

import operator
action = {
    "+": operator.add,
    "-": operator.sub,
    "/": operator.truediv,
 ...
See and Run

Random Password Generator in Python

import string, random



while True:

     hesam = int(input("لطفا طول رمز عبور خود را وارد کنید: ") ...
See and Run

Python Factorial Program: Calculate Factorial of a Number

number = int(input("please Enter integer number: "))
factorial = 1
for i in range(1, number+1):
     ...
See and Run

Find the 10001st Prime Number in Python | Efficient Code

def isPrime(n):
    if n < 2: return "Neither prime, nor composite"
    for i in range(2, int(n**0 ...
See and Run

Python String Encoding Example: UTF-8 Encode

txt = "My name is Ståle"

x = txt.encode()

print(x) ...
See and Run

Dice Roll Simulator in Python

#دوستان این کد برای تا انداختنه
#وارد برنامه میشی
#تاس میندازه و میپرسه که دوباره تاس بندازم
#با کلم ...
See and Run

Python Set pop() Method Example with Error Handling

thisset = {"apple", "banana", "cherry"}

y = thisset.pop()

print(x)

print(thisset) ...
See and Run

Generate 3-Letter Persian Words with Python

print('ساخته شده توسط حسام الدین')
from itertools import chain, permutations

characters = [
"ا",
"ب ...
See and Run

C++ 3D Array Example: Input and Display Values

#include <iostream>

using namespace std;
int main() {
  // This array can store upto 12 elements (2 ...
See and Run

Calculate Right Triangle Hypotenuse in PHP

<?php
function hypotenuse($a, $b){
    $c = sqrt(pow($a, 2) + pow($b, 2));
    return $c;
}

echo hy ...
See and Run

Amiri Puzzle Solver with Python Permutations

from itertools import chain, permutations

characters = [
'ب',
'ا',
'د',
'ر',
'گ',
'ی'
]
print("سه ح ...
See and Run