Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
1.4 kB
1
Indexable
Never
def generate_scary_code():
  """Generates a random code that leads to something scary."""

  # Choose a random programming language.
  language = random.choice(["Python", "Java", "C++"])

  # Choose a random scary topic.
  topic = random.choice(["ghosts", "zombies", "vampires"])

  # Generate some code that is related to the scary topic.
  code = ""
  if language == "Python":
    code += "import random"
    code += "
    # Generate a random number between 1 and 100.
    number = random.randint(1, 100)
    
    # If the number is 666, print a scary message.
    if number == 666:
      print('The devil is here!')
    "
  elif language == "Java":
    code += "import java.util.Random;
    
    public class ScaryCode {
      public static void main(String[] args) {
        Random rand = new Random();
        int number = rand.nextInt(100);
        if (number == 666) {
          System.out.println('The devil is here!');
        }
      }
    }
    "
  elif language == "C++":
    code += "#include <iostream>
    
    using namespace std;
    
    int main() {
      // Generate a random number between 1 and 100.
      int number = rand() % 100 + 1;
    
      // If the number is 666, print a scary message.
      if (number == 666) {
        cout << "The devil is here!" << endl;
      }
    
      return 0;
    }
    "

  return code

print(generate_scary_code())