Advertisement
biswasrohit20

q1

Mar 12th, 2021
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. # Q1
  2.  
  3. import numpy as np
  4.  
  5.  
  6. def findk(temp,comp):
  7. if 0 <= comp <= 5:
  8. if 258 <= temp < 774:
  9. k = (0.48934 * temp) - (0.48934*258) + 505
  10. elif 774 < temp <= 1290:
  11. k = (-0.48934 * temp) - (-0.48934 * 774) + 757.5
  12. elif temp == 774:
  13. k = 757.5
  14. elif 258 > temp or temp > 1290:
  15. return np.nan
  16.  
  17. elif 5 < comp <= 10:
  18. if 258 <= temp < 774:
  19. k = (-0.48934 * temp) - (-0.48934 * 258) + 757.5
  20. elif 774 < temp <= 1290:
  21. k = (0.48934 * temp) - (0.48934 * 774) + 505
  22. elif temp == 774:
  23. k = 505
  24. elif 258 > temp or temp > 1290:
  25. return np.nan
  26.  
  27. return k
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement