Jump to

step2-l1-code

How can I know how to write code in a question ?

For instance, this C++ code :

#include <iostream>

int main() {
    std::cout << "Why don't programmers like nature?" << std::endl;
    std::cout << "It has too many bugs!" << std::endl;

    return 0;
}
// @ChatGPT, after asking : "Can you write a funny C++ code ?"

or this Python code :

import time

def sarcastic_chatbot():
    print("Welcome to the Sarcastic Chatbot!")
    time.sleep(1)
    print("How can I help you today?")

    while True:
        user_input = input("> ").strip().lower()

        if "hello" in user_input:
            print("Oh, what a surprise! Another 'hello'!")
        elif "how are you" in user_input:
            print("Oh, I'm just a computer program. I have no feelings. But thanks for asking.")
        elif "tell me a joke" in user_input:
            print("Why did the programmer go broke?")
            time.sleep(1)
            print("Because he used up all his cache!")
        elif "bye" in user_input:
            print("Goodbye! Don't miss me too much.")
            break
        else:
            print("Wow, your input is truly groundbreaking! I'm in awe.")

if __name__ == "__main__":
    sarcastic_chatbot()
# @ChatGPT, after asking : "Can you write a more funnier code example in Python ?"

???

Inline code also works, like variable=0. However, because of some historical reasons, this is automatically rendered as C++ code.