Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

deleted 37 characters in body
Source Link
O.O.Balance
  • 1.6k
  • 1
  • 10
  • 19

Emojicode, 186(削除) 186 (削除ここまで) 162 bytes

📦files🏠🏁🍇🔂b🍺📇🐇📄🆕🔡👂🏼❗️❗️🍇🔡🔢b❗️16❗️➡️h👄📫🍪🔪🔤0🔤0📦files🏠🏁🍇🔂b🍺📇🐇📄🆕🔡👂🏼❗️❗️🍇👄📫🍪🔪🔡🔢b❗️➕256 2➖📐h❗️❗️h🔤16❗️1 2❗️🔤 🔤🍪❗️❗️🍉🍉

Try it online here. here.

Ungolfed:

📦 files 🏠 💭 Import the files package into the default namespace
🏁 🍇 💭 Main code block
🔂 b 💭 For each b in ...
 🍺 💭 (ignoring IO errors)
 📇 🐇 📄 💭 ... the byte representation of the file ...
 🆕 🔡 👂🏼 💭 ... read from user input:
 ❗️ ❗️ 🍇
 🔡 🔢 b ❗️ 16 ❗️ ➡️ h 💭 Assign the hexadecimal representation of b to h
 👄 💭 Print ...
 📫 💭 ... in upper case (numbers in bases > 10 are in lower case) ...
 🍪 💭 ... the concatenation of:
 🔪 🔤0🔤🔡 🔢 b ❗️ ➕ 256  💭 Ab + 256 (this gives the leading '0'zero ...
in case the hex representation of b is a 0single digit) ...
 2  📐h❗️ 16  💭 ... onlyrepresented ifin thehexadecimal hex...
 representation is just 1 byte,
 ❗️
 h 1 2 💭 ... without the leading one,
 or two-digit hex representation ... ❗️
 🔤 🔤 💭 ... and a space
 🍪
 ❗️❗️
 🍉
🍉

Emojicode, 186 bytes

📦files🏠🏁🍇🔂b🍺📇🐇📄🆕🔡👂🏼❗️❗️🍇🔡🔢b❗️16❗️➡️h👄📫🍪🔪🔤0🔤0 2➖📐h❗️❗️h🔤 🔤🍪❗️❗️🍉🍉

Try it online here.

Ungolfed:

📦 files 🏠 💭 Import the files package into the default namespace
🏁 🍇 💭 Main code block
🔂 b 💭 For each b in ...
 🍺 💭 (ignoring IO errors)
 📇 🐇 📄 💭 ... the byte representation of the file ...
 🆕 🔡 👂🏼 💭 ... read from user input:
 ❗️ ❗️ 🍇
 🔡 🔢 b ❗️ 16 ❗️ ➡️ h 💭 Assign the hexadecimal representation of b to h
 👄 💭 Print ...
 📫 💭 ... in upper case (numbers in bases > 10 are in lower case) ...
 🍪 💭 ... the concatenation of:
 🔪 🔤0🔤 💭 A leading '0' ...
 0
 2  📐h❗️ 💭 ... only if the hex representation is just 1 byte,
 ❗️
 h 💭 ... the one or two-digit hex representation ...
 🔤 🔤 💭 ... and a space
 🍪
 ❗️❗️
 🍉
🍉

Emojicode, (削除) 186 (削除ここまで) 162 bytes

📦files🏠🏁🍇🔂b🍺📇🐇📄🆕🔡👂🏼❗️❗️🍇👄📫🍪🔪🔡🔢b❗️➕256 16❗️1 2❗️🔤 🔤🍪❗️❗️🍉🍉

Try it online here.

Ungolfed:

📦 files 🏠 💭 Import the files package into the default namespace
🏁 🍇 💭 Main code block
🔂 b 💭 For each b in ...
 🍺 💭 (ignoring IO errors)
 📇 🐇 📄 💭 ... the byte representation of the file ...
 🆕 🔡 👂🏼 💭 ... read from user input:
 ❗️ ❗️ 🍇
 👄 💭 Print ...
 📫 💭 ... in upper case (numbers in bases > 10 are in lower case) ...
 🍪 💭 ... the concatenation of:
 🔪 🔡 🔢 b ❗️ ➕ 256  💭 b + 256 (this gives the leading zero in case the hex representation of b is a single digit) ...
 16  💭 ... represented in hexadecimal ...
 ❗️
 1 2 💭 ... without the leading one,
  ❗️
 🔤 🔤 💭 ... and a space
 🍪
 ❗️❗️
 🍉
🍉
Source Link
O.O.Balance
  • 1.6k
  • 1
  • 10
  • 19

Emojicode, 186 bytes

📦files🏠🏁🍇🔂b🍺📇🐇📄🆕🔡👂🏼❗️❗️🍇🔡🔢b❗️16❗️➡️h👄📫🍪🔪🔤0🔤0 2➖📐h❗️❗️h🔤 🔤🍪❗️❗️🍉🍉

Try it online here.

Ungolfed:

📦 files 🏠 💭 Import the files package into the default namespace
🏁 🍇 💭 Main code block
🔂 b 💭 For each b in ...
 🍺 💭 (ignoring IO errors)
 📇 🐇 📄 💭 ... the byte representation of the file ...
 🆕 🔡 👂🏼 💭 ... read from user input:
 ❗️ ❗️ 🍇
 🔡 🔢 b ❗️ 16 ❗️ ➡️ h 💭 Assign the hexadecimal representation of b to h
 👄 💭 Print ...
 📫 💭 ... in upper case (numbers in bases > 10 are in lower case) ...
 🍪 💭 ... the concatenation of:
 🔪 🔤0🔤 💭 A leading '0' ...
 0
 2 ➖ 📐h❗️ 💭 ... only if the hex representation is just 1 byte,
 ❗️
 h 💭 ... the one or two-digit hex representation ...
 🔤 🔤 💭 ... and a space
 🍪
 ❗️❗️
 🍉
🍉

AltStyle によって変換されたページ (->オリジナル) /