Parse variables

This commit is contained in:
Oystein Kristoffer Tveit 2020-08-26 15:23:46 +02:00
parent 118519bb41
commit 16e54a9b13

View File

@ -0,0 +1,8 @@
AVOGADROS_CONSTANT = 6.022e23
substance = input('Si et stoff du er i besittelse av: ')
weight = float(input('Hva er molvekt i gram for vann? '))
amount = float(input('Hvor mange gram vann har du? '))
numberOfMolecules = (amount * AVOGADROS_CONSTANT / weight)
print(f'Du har {format(numberOfMolecules, ".1e")} molekyler {substance.lower()}')