Saturday, 24 August 2024

Fetching and Displaying Periodic Table Data in Python


 Periodic Table Data in Python

pip install chempy


from chempy.util import periodic


n = int(input("Enter number to see the table: "))

print("Atomic No.\tName\t\tSymbol\t\tMass")


for i in range(1, n + 1):

    print(i, end="\t\t")

    if len(periodic.names[i]) > 7:

        print(periodic.names[i], end="\t")

    else:

        print(periodic.names[i], end="\t\t")

    print(periodic.symbols[i], end="\t\t")

    print(periodic.relative_atomic_masses[i])

#source code --> clcoding.com

Atomic No. Name Symbol Mass

1 Helium He 4.002602

2 Lithium Li 6.94

3 Beryllium Be 9.0121831

4 Boron B 10.81

5 Carbon C 12.011

6 Nitrogen N 14.007

7 Oxygen O 15.999

8 Fluorine F 18.998403163

9 Neon Ne 20.1797

10 Sodium Na 22.98976928

11 Magnesium Mg 24.305

12 Aluminium Al 26.9815384

13 Silicon Si 28.085

14 Phosphorus P 30.973761998

15 Sulfur S 32.06

16 Chlorine Cl 35.45

17 Argon Ar 39.95

18 Potassium K 39.0983

19 Calcium Ca 40.078

20 Scandium Sc 44.955908

0 Comments:

Post a Comment

Popular Posts

Categories

100 Python Programs for Beginner (49) AI (34) Android (24) AngularJS (1) Assembly Language (2) aws (17) Azure (7) BI (10) book (4) Books (173) C (77) C# (12) C++ (82) Course (67) Coursera (226) Cybersecurity (24) data management (11) Data Science (128) Data Strucures (8) Deep Learning (20) Django (14) Downloads (3) edx (2) Engineering (14) Excel (13) Factorial (1) Finance (6) flask (3) flutter (1) FPL (17) Google (34) Hadoop (3) HTML&CSS (47) IBM (25) IoT (1) IS (25) Java (93) Leet Code (4) Machine Learning (59) Meta (22) MICHIGAN (5) microsoft (4) Nvidia (3) Pandas (4) PHP (20) Projects (29) Python (929) Python Coding Challenge (351) Python Quiz (21) Python Tips (2) Questions (2) R (70) React (6) Scripting (1) security (3) Selenium Webdriver (3) Software (17) SQL (42) UX Research (1) web application (8) Web development (2) web scraping (2)

Followers

Person climbing a staircase. Learn Data Science from Scratch: online program with 21 courses