The Nerdy Sixty | (29/60) NaN NaN NaN… | Solution

In Python, what is the output of `print(“NaN” * 16)` and why is it amusing?

Hint 1: NaN stands for Not-a-Number, but here it’s just text. Repeating it creates a pattern.

Hint 2: Print(“NaN” * 16) and think of the Batman theme.

 

Solution:

`”NaN” * 16` produces “NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN”. When you read the “NaN”s in groups (NaN NaN NaN…), it mimics the “na na na na… Batman!” rhythm from the classic TV theme. It’s a silly coincidence when repeating the string “NaN”.

 

 


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

WordPress Cookie Notice by Real Cookie Banner