• Drekaridill@lemmy.wtf
    link
    fedilink
    arrow-up
    14
    ·
    3 hours ago

    I was a TA in a class that expected knowledge of C. A lot of students who had only ever used Python asked if I could ring them up to speed. One student even asked if he could write it in Python and then I could “just translate it over”

    • Dumhuvud@programming.dev
      link
      fedilink
      English
      arrow-up
      2
      ·
      29 minutes ago

      It’s rather trivial to translate Python to C:

      $ cat << EOF > ./shitpost.c && gcc -O2 -o ./shitpost ./shitpost.c && ./shitpost
      #include <stdlib.h>
      
      int main(int argc, char** argv) {
          system("python3 -c \\"print(\\\\\\"Hello, World!\\\\\\")\\"");
          return 0;
      }
      EOF
      Hello, World!
      

      My C is a bit rusty though, sorry.