Popularity

3 out of 5 levels

about 30K users per month
Visit

Service information

Platforms

Description

CodeGeeX is an online service that offers code generation, code translation, and code explanation. It is available through an extension and API, and receives around 100,000 monthly visits.

Examples

💻🔢

Generate Code

inputs

// Given two non-negative integers, num1 and num2 represented as string, return the sum of num1 and num2 as a string.

// You must solve the problem without using any built-in library for handling large integers (such as BigInteger). You must also not convert the inputs to integers directly.

outputs

public String addStrings(String num1, String num2) {

    char[] c1 = num1.toCharArray();

    char[] c2 = num2.toCharArray();

    StringBuilder sb = new StringBuilder();

    int carry = 0;

💻🔀

Convert Code

inputs

def pairs_sum_to_zero(l):

    for i, l1 in enumerate(l):

        for j in range(i + 1, len(l)):

            if l1 + l[j] == 0:

                return True

    return False

outputs

public class PairsSumToZero{

    public boolean pairs_sum_to_zero(int[] arr) {

        Map<Integer, Integer> map = new HashMap();

        for (int i = 0; i < arr.length; i++) {

            map.put(arr[i], i);

        }

        for (int i = 0; i < arr.length; i++) {

            int x = 0 - arr[i];

            if (map.containsKey(x)) {

                if (map.get(x) == i) {

                    continue;

                } else {

                    return true;

                }

            }

        }

        return false;

    }

}

💻🔍

Explain Code

inputs

import random

def generate_random_password(length):

  characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()'

  password = ''.join(random.choice(characters) for _ in range(length))

  return password

password_length = int(input("Enter the length of the password: "))

random_password = generate_random_password(password_length)

print("Randomly generated password:", random_password)

outputs

#Prompt the user to enter the length of the password

password_length = int(input("Enter the length of the password: "))

#Generate a random password of the given length

random_password = generate_random_password(password_length)

print("Randomly generated password:", random_password)

Features

  • Code completion and suggestion
  • Code translation
  • Automatic comment generation
  • Fixing code bugs
  • Compatibility with various IDEs

Perfect for

  • Developers
  • Programmers
  • Frontend engineers
  • Python developers
  • Blog writers
Share this page: