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

added 242 characters in body
Source Link
user45941
user45941

Python 3, 566 bytes

n="HᱨἬᨊBCNOFỆᶎỻ᭬∋PS᱄ᳲKᥣ’≴VᷖNoᮞᴍ ̔ẟ⚬᫧ᰃG₿uVIIὤ⓶Y⠔ᷜIV=╺1⁄7ὀᨧᨬ὞⎪ῆZI⊸ḙᤂ᳌ᩯ⎠Ṹ∐⍗ᾉᮼ
.ἸẺ⏄−⊼Ჰ῔W⁚⍽2⑀ƫ᳸⍰Ạᬒ⊰ᵴ⌼Ἤἒᤣ∠ṐU∠9.ᮭᲇᮖ᪲ỿ᷎"
m="!$')+,.03478;<?@CHGHMPSTWX[[`afikoptuxy{} £\©«¬­°±¶ ̧1⁄2¿ÃÅÇÉÍÏÒÕØÚÞàãåéìïññòþÿĂăĈćĎčĔēėėěĜġ"
i=lambda w:f.reduce(lambda l,c:l*ord(c),list(w),1)
print(str(ord(m[n.find(chr(i(input())))])-32))

Python 3 , 560 bytes

import functools as f
n="HᱨἬᨊBCNOFỆᶎỻ᭬∋PS᱄ᳲKᥣ’≴VᷖNoᮞᴍ ̔ẟ⚬᫧ᰃG₿uVIIὤ⓶Y⠔ᷜIV=╺1⁄7ὀᨧᨬ὞⎪ῆZI⊸ḙᤂ᳌ᩯ⎠Ṹ∐⍗ᾉᮼ
.ἸẺ⏄−⊼Ჰ῔W⁚⍽2⑀ƫ᳸⍰Ạᬒ⊰ᵴ⌼Ἤἒᤣ∠ṐU∠9.ᮭᲇᮖ᪲ỿ᷎"
m="!$')+,.03478;<?@CHGHMPSTWX[[`afikoptuxy{}€‚…‡ŠŒ“—š Ÿ£\©«¬­°±¶ ̧1⁄2¿ÃÅÇÉÍÏÒÕØÚÞàãåéìïññòþÿĂăĈćĎčĔēėėěĜġ"
i=lambda w:f.reduce(lambda l,c:l*ord(c),list(w),1)
print(str(ord(m[n.find(chr(i(input())))])-32))

Try it online! Try it online!

Explanation: So 2 variables, n and m are used to hold the abbreviations (more described below) and the elements atomic mass as strings. The input is then encrypted into a character to match to some character in n, using the string.find, an index of where the character is can be used to find the respective atomic mass in m. Due to shifting the mass values by 32 previously, they must be unshifted, then this number is output.

Each character of n is the ascii of the product of the ascii values of the characters in the name Each character of m is the ascii of mass + 32

Below is the setup code for m and n

obfNames="" for name in names: prod=1 for c in name: prod*=ord(c) obfNames+=chr(prod) obfMass="" for m in mass: obfMass+=chr(int(m)+32) for c in obfNames: print(c,end="") print() for c in obfMass: print(c,end="")

obfNames=""
for name in names:
 prod=1
 for c in name:
 prod*=ord(c)
 obfNames+=chr(prod)
obfMass=""
for m in mass:
 obfMass+=chr(int(m)+32)
for c in obfNames:
 print(c,end="")
print()
for c in obfMass:
 print(c,end="")

Try it online!

Python 3, 566 bytes

n="HᱨἬᨊBCNOFỆᶎỻ᭬∋PS᱄ᳲKᥣ’≴VᷖNoᮞᴍ ̔ẟ⚬᫧ᰃG₿uVIIὤ⓶Y⠔ᷜIV=╺1⁄7ὀᨧᨬ὞⎪ῆZI⊸ḙᤂ᳌ᩯ⎠Ṹ∐⍗ᾉᮼ
.ἸẺ⏄−⊼Ჰ῔W⁚⍽2⑀ƫ᳸⍰Ạᬒ⊰ᵴ⌼Ἤἒᤣ∠ṐU∠9.ᮭᲇᮖ᪲ỿ᷎"
m="!$')+,.03478;<?@CHGHMPSTWX[[`afikoptuxy{} £\©«¬­°±¶ ̧1⁄2¿ÃÅÇÉÍÏÒÕØÚÞàãåéìïññòþÿĂăĈćĎčĔēėėěĜġ"
i=lambda w:f.reduce(lambda l,c:l*ord(c),list(w),1)
print(str(ord(m[n.find(chr(i(input())))])-32))

Try it online!

Explanation: So 2 variables, n and m are used to hold the abbreviations (more described below) and the elements atomic mass as strings. The input is then encrypted into a character to match to some character in n, using the string.find, an index of where the character is can be used to find the respective atomic mass in m. Due to shifting the mass values by 32 previously, they must be unshifted, then this number is output.

Each character of n is the ascii of the product of the ascii values of the characters in the name Each character of m is the ascii of mass + 32

Below is the setup code for m and n

obfNames="" for name in names: prod=1 for c in name: prod*=ord(c) obfNames+=chr(prod) obfMass="" for m in mass: obfMass+=chr(int(m)+32) for c in obfNames: print(c,end="") print() for c in obfMass: print(c,end="")

Try it online!

Python 3 , 560 bytes

import functools as f
n="HᱨἬᨊBCNOFỆᶎỻ᭬∋PS᱄ᳲKᥣ’≴VᷖNoᮞᴍ ̔ẟ⚬᫧ᰃG₿uVIIὤ⓶Y⠔ᷜIV=╺1⁄7ὀᨧᨬ὞⎪ῆZI⊸ḙᤂ᳌ᩯ⎠Ṹ∐⍗ᾉᮼ
.ἸẺ⏄−⊼Ჰ῔W⁚⍽2⑀ƫ᳸⍰Ạᬒ⊰ᵴ⌼Ἤἒᤣ∠ṐU∠9.ᮭᲇᮖ᪲ỿ᷎"
m="!$')+,.03478;<?@CHGHMPSTWX[[`afikoptuxy{}€‚…‡ŠŒ“—š Ÿ£\©«¬­°±¶ ̧1⁄2¿ÃÅÇÉÍÏÒÕØÚÞàãåéìïññòþÿĂăĈćĎčĔēėėěĜġ"
i=lambda w:f.reduce(lambda l,c:l*ord(c),list(w),1)
print(str(ord(m[n.find(chr(i(input())))])-32))

Try it online!

Explanation: So 2 variables, n and m are used to hold the abbreviations (more described below) and the elements atomic mass as strings. The input is then encrypted into a character to match to some character in n, using the string.find, an index of where the character is can be used to find the respective atomic mass in m. Due to shifting the mass values by 32 previously, they must be unshifted, then this number is output.

Each character of n is the ascii of the product of the ascii values of the characters in the name Each character of m is the ascii of mass + 32

Below is the setup code for m and n

obfNames=""
for name in names:
 prod=1
 for c in name:
 prod*=ord(c)
 obfNames+=chr(prod)
obfMass=""
for m in mass:
 obfMass+=chr(int(m)+32)
for c in obfNames:
 print(c,end="")
print()
for c in obfMass:
 print(c,end="")

Try it online!

Source Link
Josh B.
  • 135
  • 1
  • 6

Python 3, 566 bytes

n="HᱨἬᨊBCNOFỆᶎỻ᭬∋PS᱄ᳲKᥣ’≴VᷖNoᮞᴍ ̔ẟ⚬᫧ᰃG₿uVIIὤ⓶Y⠔ᷜIV=╺1⁄7ὀᨧᨬ὞⎪ῆZI⊸ḙᤂ᳌ᩯ⎠Ṹ∐⍗ᾉᮼ
.ἸẺ⏄−⊼Ჰ῔W⁚⍽2⑀ƫ᳸⍰Ạᬒ⊰ᵴ⌼Ἤἒᤣ∠ṐU∠9.ᮭᲇᮖ᪲ỿ᷎"
m="!$')+,.03478;<?@CHGHMPSTWX[[`afikoptuxy{} £\©«¬­°±¶ ̧1⁄2¿ÃÅÇÉÍÏÒÕØÚÞàãåéìïññòþÿĂăĈćĎčĔēėėěĜġ"
i=lambda w:f.reduce(lambda l,c:l*ord(c),list(w),1)
print(str(ord(m[n.find(chr(i(input())))])-32))

Try it online!

Explanation: So 2 variables, n and m are used to hold the abbreviations (more described below) and the elements atomic mass as strings. The input is then encrypted into a character to match to some character in n, using the string.find, an index of where the character is can be used to find the respective atomic mass in m. Due to shifting the mass values by 32 previously, they must be unshifted, then this number is output.

Each character of n is the ascii of the product of the ascii values of the characters in the name Each character of m is the ascii of mass + 32

Below is the setup code for m and n

obfNames="" for name in names: prod=1 for c in name: prod*=ord(c) obfNames+=chr(prod) obfMass="" for m in mass: obfMass+=chr(int(m)+32) for c in obfNames: print(c,end="") print() for c in obfMass: print(c,end="")

Try it online!

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