Skip to main content
Golfing
Source Link

Python / Pyth, 2424 22 bytes

Thanks to @Loovjo and @Pietu1998 for some help

#"treat".q
print"trick";

In Pyth, this outputsoutputs treat. In Python, this outputsoutputs trick.

How it works

Python

#"treat".q       Comment
print"trick";  Print the string literal "trick"

Pyth

#"treat".q     
#              Loop until error statement
 "treat"       Implicitly print the string literal "treat"
print"trick";  Throws an error since n has no .qright operand, breaking out of the Quitloop
print"trick";  Ignored, except the           The last ";" asis a valid EOF

Python / Pyth, 24 bytes

#"treat".q
print"trick";

In Pyth, this outputs treat. In Python, this outputs trick.

How it works

Python

#"treat".q     Comment
print"trick";  Print the string literal "trick"

Pyth

#"treat".q     
#              Loop until error statement
 "treat"       Implicitly print the string literal "treat"
        .q     Quit
print"trick";  Ignored, except the last ";" as a valid EOF

Python / Pyth, 24 22 bytes

Thanks to @Loovjo and @Pietu1998 for some help

#"treat"
print"trick";

In Pyth, this outputs treat. In Python, this outputs trick.

How it works

Python

#"treat"       Comment
print"trick";  Print the string literal "trick"

Pyth

#"treat"     
#              Loop until error statement
 "treat"       Implicitly print the string literal "treat"
print"trick";  Throws an error since n has no right operand, breaking out of the loop
               The last ";" is a valid EOF
Source Link

Python / Pyth, 24 bytes

#"treat".q
print"trick";

In Pyth, this outputs treat. In Python, this outputs trick.

How it works

Python

#"treat".q     Comment
print"trick";  Print the string literal "trick"

Pyth

#"treat".q     
#              Loop until error statement
 "treat"       Implicitly print the string literal "treat"
        .q     Quit
print"trick";  Ignored, except the last ";" as a valid EOF