coefficients.py 580 B

12345678910111213141516171819
  1. class coefficients:
  2. def __init__(self, diff, conv, flux):
  3. self.diffusion = diff
  4. self.covection = conv
  5. self.flux = flux
  6. @classmethod
  7. def from_input(cls):
  8. while True:
  9. try:
  10. diff = float(input("Diffusion coefficient "))
  11. conv = float(input("Covection coefficient: "))
  12. flux = float(input("Flux: "))
  13. except ValueError:
  14. print("Sorry, wrong data type.")
  15. continue
  16. else:
  17. break
  18. return cls(diff, conv, flux)