Sprint View

Challenge Submission Test

1 min read

Challenge Submission Test

This notebook tests the new challenge submission feature. When challenge_submit: true is set in the frontmatter:

  1. Each code runner gets a Submit Challenge button
  2. At the bottom, there’s a Submit All Challenges button

Challenge 1: Hello World

Code Runner Challenge

Write a Hello World program

View IPYNB Source
// CODE_RUNNER: Write a Hello World program

public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, World!");
    }
}

HelloWorld.main(null);
Lines: 1 Characters: 0
Output
Click "Run" in code control panel to see output ...

Challenge 2: Sum of Two Numbers

Code Runner Challenge

Create a method that adds two numbers

View IPYNB Source
// CODE_RUNNER: Create a method that adds two numbers

public class Calculator {
    public static int add(int a, int b) {
        // TODO: Implement this method
        return 0;
    }
    
    public static void main(String[] args) {
        System.out.println("5 + 3 = " + add(5, 3));
    }
}

Calculator.main(null);
Lines: 1 Characters: 0
Output
Click "Run" in code control panel to see output ...

Challenge 3: FizzBuzz

Code Runner Challenge

Implement FizzBuzz for numbers 1-15

View IPYNB Source
// CODE_RUNNER: Implement FizzBuzz for numbers 1-15

public class FizzBuzz {
    public static void main(String[] args) {
        for (int i = 1; i <= 15; i++) {
            // TODO: Print "Fizz" for multiples of 3
            // Print "Buzz" for multiples of 5
            // Print "FizzBuzz" for multiples of both
            // Otherwise print the number
            System.out.println(i);
        }
    }
}

FizzBuzz.main(null);
Lines: 1 Characters: 0
Output
Click "Run" in code control panel to see output ...

Submit Your Work

Submit all your code challenges for this lesson.

Preview Submission (0 challenges)

Course Timeline