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 108 characters in body
Source Link
sugarfi
  • 2.2k
  • 15
  • 24

Python 3, 13483 bytes

x=input();n=['met','eth','pro','but','pen','hex','hep','oct','non','dec'];n=list('_mepbPhHond').index(x[:-3][:3]x[0])+1;print;print(n,2*n+{'a':2,'e':0,'y':-2}[x[-3]])

Try it online! Try it online!

Only accepts lower case, like the other answer.-51 bytes thanks to 79037662

Python 3, 134 bytes

x=input();n=['met','eth','pro','but','pen','hex','hep','oct','non','dec'].index(x[:-3][:3])+1;print(n,2*n+{'a':2,'e':0,'y':-2}[x[-3]])

Try it online!

Only accepts lower case, like the other answer.

Python 3, 83 bytes

x=input();n=list('_mepbPhHond').index(x[0]);print(n,2*n+{'a':2,'e':0,'y':-2}[x[-3]])

Try it online!

-51 bytes thanks to 79037662

Source Link
sugarfi
  • 2.2k
  • 15
  • 24

Python 3, 134 bytes

x=input();n=['met','eth','pro','but','pen','hex','hep','oct','non','dec'].index(x[:-3][:3])+1;print(n,2*n+{'a':2,'e':0,'y':-2}[x[-3]])

Try it online!

Only accepts lower case, like the other answer.

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