this post was submitted on 01 Jul 2023
19 points (88.0% liked)

Python

6337 readers
36 users here now

Welcome to the Python community on the programming.dev Lemmy instance!

πŸ“… Events

PastNovember 2023

October 2023

July 2023

August 2023

September 2023

🐍 Python project:
πŸ’“ Python Community:
✨ Python Ecosystem:
🌌 Fediverse
Communities
Projects
Feeds

founded 1 year ago
MODERATORS
19
Python 2 in Python 3! (programming.dev)
submitted 1 year ago* (last edited 1 year ago) by qwop@programming.dev to c/python@programming.dev
 

A post about how this community's banner used the python 2 print syntax - print "Hello World" - made me question, can we print a hello world message in Python 3 without using parentheses?

It turned out to be sort of a fun challenge, I've found 3 different approaches that work. I'd be interested to see what you come up with! (it seems I can't put spoilers in Lemmy, so I won't share my solutions yet in case y'all want to have a go).

Edit: Posted my solutions in the comments

you are viewing a single comment's thread
view the rest of the comments
[–] jormaig@programming.dev 3 points 1 year ago (1 children)

You could base64 encode the solution

[–] McCheng@lemmy.fmhy.ml 3 points 1 year ago (1 children)

But then you still need to use parentheses to decode it

[–] jormaig@programming.dev 2 points 1 year ago (1 children)

Ah sorry I meant for the spoiler. He could base64 the solution given that he doesn't know how to do spoilers on lemmy

[–] qwop@programming.dev 1 points 1 year ago

Ah true that would have worked, figured since spoilers don't work on most apps I might as well just post them.