-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTemperature.py
540 lines (358 loc) · 18.4 KB
/
Temperature.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
# Here is another conversion units of temperature related
# Following units are envolved here
# Celsius, Fahrenheit, Kelvin, Rankine, reaumur
# It contains different methods regariding the calculation of temperature in different available units
# further description is been given below regarding the code and method's explanation
"""---- Main File contains the Methods or Functions that are mentioned below ! -----"""
celsius_methods = [
'__init__(self)',
'c2F(self,value)',
'c2k(self,value)',
'c2rrankine(self,value)',
'c2reaumur'
]
class celsius:
celsius = 0
# ------------ Initial Methods for initiating objects and their overview on different available methods ------------------
# ------------------------------------------------------------------------------------------------------------------------
# This Module together with the intial one have its overall proper data over to the Github : @ackwolver335 ---------------
def __init__(self):
"""
:: Temperature Module ::
Class : celsius
Function : __init__(self) it don't contains different arguments at its initial phase
We are getting the data at the runtime of the Program.
Also the available data members of this one is explained below :
1. celsius : This is generally used in order to store the value after getting converted in the required unit in Temperature.
Temperature Module -> Designed by Abhay Chaudhary.
"""
# Here we have a general use of pass keyword as we don't have further code in __init__() method.
pass
def c2F(self,value):
"""
:: Temperature Module ::
Class : celsius
Function : c2F(self,value) in general for conversion of one unit into another, we uses this value.
Arguments :
value : It stands for the value of celsius to be converted into Fahrenheit Temperature Unit.
Temperature Module -> Designed by Abhay Chaudhary
"""
# main source code for conversion of units
# contains the formula for conversion of celsius into Fahrenheit Unit
celsius = (value * 1.8) + 32
return celsius
def c2k(self,value):
"""
:: Temperature Module ::
Class : celsius
Function : c2k(self,value) in general for conversion of celsius into kelvin temperature with the use of this value.
Arguments :
1. value : It is the main source value regarding the conversion.
Temperature Module -> Designed by Abhay Chaudhary.
"""
# main source code for conversion of units
# contains the formula for conversion of celsius into kelvin unit
celsius = value + 273.15
return celsius
def c2rrankine(self,value):
"""
:: Temperature Module ::
Class : celsius
Function : c2rrankine(self,value), it contains value argument and self for conversion of temperature into rankine unit.
Arguments :
1. value : It is the value of celsius used for conversion into kelvin unit.
Temperature Module -> Designed by Abhay Chaudhary.
"""
# main source code for conversion of units
# contains the formula for conversion of celsius unit into rankine unit
celsius = ((value * 1.8) + 32) + 459.67
return celsius
def c2reaumur(self,value):
"""
:: Temperature Module ::
Class : celsius
Function : c2reaumur(self,value) its main purpose is to convert the celsius temperature unit into reaumur unit.
Arguments :
1. value : It is the value of celsius used for conversion into reaumur units.
Temperature Module -> Designed by Abhay Chaudhary.
"""
# main source code for conversion of units
# contains the formula for conversion of celsius unit into reaumur unit
celsius = value * 0.8
return celsius
class Fahrenheit:
fahrenheit = 0
# ------------------------------------------ Initial Methods of Fahrenhiet Class -----------------------------------------
# ------------------------------------------------------------------------------------------------------------------------
# This class and its methods has its original phase with its overall data on Github Repository : @ackwolver335 -----------
def __init__(self):
"""
:: Temperature Module ::
Class : Fahrenheit
Function : __init__(self) this is a general initiating function or method that is used in order to initiate the class
Further data is over to the runtime of the class's method.
Also below we have the variable available and used in this class :
1. fahrenheit : It is used for storing and then returning the data after getting its final unit value in Temperature.
Temperature Module -> Designed by Abhay Chaudhary
"""
# General pass keyword or statement added for simple __init__() method.
pass
def f2c(self,value):
"""
:: Temperature Module ::
Class : Fahrenheit
Function : f2c(self,value) it is structured and is been defined in a way in order to convert the fahrenheit into celsius
Arguments :
1. value : Used for conversion from initial fahrenheit unit to final celsius unit
Temperature Module -> Designed by Abhay Chaudhary
"""
# main code data and structure below
# also we have the formula if someone visit the module and want to know how to code works
fahrenheit = (value - 32) / 1.8
return fahrenheit
def f2k(self,value):
"""
:: Temperature Module ::
Class : Fahrenheit
Function : f2k(self,value) is used for conversion of fahrenheit unit of temperature to kelvin unit.
Arguments :
1. value : Used for storing the values in which is converted or to be convered into different units.
Temperature Module -> Designed by Abhay Chaudhary
"""
# main code data and structure below
# Also contains the formular regarding unit conversion
fahrenheit = (value + 459) / 1.8
return fahrenheit
def f2rankine(self,value):
"""
:: Temperature Module ::
Class : Fahrenheit
Function : f2rankine(self,value) is used for conversion of fahrenheit unit of temperature to rankine unit.
Arguments :
1. value : Used for storing the values in which is converted or to be convered into different units.
Temperature Module -> Designed by Abhay Chaudhary
"""
# main code data and structure below
# Also contains the formular regarding unit conversion
fahrenheit = value + 459
return fahrenheit
def f2reaumur(self,value):
"""
:: Temperature Module ::
Class : Fahrenheit
Function : f2reaumur(self,value) is used for conversion of fahrenheit unit of temperature to reaumur unit.
Arguments :
1. value : Used for storing the values in which is converted or to be convered into different units.
Temperature Module -> Designed by Abhay Chaudhary
"""
# main code data and structure below
# Also contains the formular regarding unit conversion
fahrenheit = (self.fahrenheit - 32) / 2.25
return fahrenheit
class Kelvin:
kelvin = 0
# ------------------------------------------ Initial Methods of Kelvin Class ---------------------------------------------
# ------------------------------------------------------------------------------------------------------------------------
# This class and its methods has its original phase with its overall data on Github Repository : @ackwolver335 -----------
def __init__(self):
"""
:: Temperature Module ::
Class : Kelvin
Function : __init__(self) it don't contains different arguments at its initial phase
We are getting the data at the runtime of the Program.
Also the available data members of this one is explained below :
1. celsius : This is generally used in order to store the value after getting converted in the required unit in Temperature.
Temperature Module -> Designed by Abhay Chaudhary.
"""
# Here we have a general use of pass keyword as we don't have further code in __init__() method.
pass
def k2F(self,value):
"""
:: Temperature Module ::
Class : Kelvin
Function : k2F(self,value) is used for conversion of kelvin unit of temperature to fahrenheit unit.
Arguments :
1. value : Used for storing the values in which is converted or to be convered into different units.
Temperature Module -> Designed by Abhay Chaudhary
"""
# main code data and structure below
# Also contains the formular regarding unit conversion
kelvin = (value * 1.8) - 459
return kelvin
def k2c(self,value):
"""
:: Temperature Module ::
Class : Kelvin
Function : k2c(self,value) is used for conversion of kelvin unit of temperature to celsius unit.
Arguments :
1. value : Used for storing the values in which is converted or to be convered into different units.
Temperature Module -> Designed by Abhay Chaudhary
"""
# main code data and structure below
# Also contains the formular regarding unit conversion
kelvin = value - 273.15
return kelvin
def k2rankine(self,value):
"""
:: Temperature Module ::
Class : Kelvin
Function : k2rankine(self,value) is used for conversion of kelvin unit of temperature to rankine unit.
Arguments :
1. value : Used for storing the values in which is converted or to be convered into different units.
Temperature Module -> Designed by Abhay Chaudhary
"""
# main code data and structure below
# Also contains the formular regarding unit conversion
kelvin = value * 1.8
return kelvin
def k2reaumur(self,value):
"""
:: Temperature Module ::
Class : Kelvin
Function : k2reaumur(self,value) is used for conversion of kelvin unit of temperature to reaumur unit.
Arguments :
1. value : Used for storing the values in which is converted or to be convered into different units.
Temperature Module -> Designed by Abhay Chaudhary
"""
# main code data and structure below
# Also contains the formular regarding unit conversion
kelvin = (value - 273.15) * 0.8
return kelvin
class Rankine:
rankine = 0
# ------------------------------------------ Initial Methods of Rankine Class --------------------------------------------
# ------------------------------------------------------------------------------------------------------------------------
# This class and its methods has its original phase with its overall data on Github Repository : @ackwolver335 -----------
def __init__(self):
"""
:: Temperature Module ::
Class : Rankine
Function : __init__(self) it don't contains different arguments at its initial phase
We are getting the data at the runtime of the Program.
Also the available data members of this one is explained below :
1. celsius : This is generally used in order to store the value after getting converted in the required unit in Temperature.
Temperature Module -> Designed by Abhay Chaudhary.
"""
# Here we have a general use of pass keyword as we don't have further code in __init__() method.
pass
def rank2F(self,value):
"""
:: Temperature Module ::
Class : Rankine
Function : rank2F(self,value) is used for conversion of rankine unit of temperature to fahrenheit unit.
Arguments :
1. value : Used for storing the values in which is converted or to be convered into different units.
Temperature Module -> Designed by Abhay Chaudhary
"""
# main code data and structure below
# Also contains the formular regarding unit conversion
rankine = value - 459
return rankine
def rank2C(self,value):
"""
:: Temperature Module ::
Class : Rankine
Function : rank2c(self,value) is used for conversion of rankine unit of temperature to celsius unit.
Arguments :
1. value : Used for storing the values in which is converted or to be convered into different units.
Temperature Module -> Designed by Abhay Chaudhary
"""
# main code data and structure below
# Also contains the formular regarding unit conversion
rankine = ((value - 32) - 459) / 1.8
return rankine
def rank2k(self,value):
"""
:: Temperature Module ::
Class : Rankine
Function : rank2k(self,value) is used for conversion of rankine unit of temperature to kelvin unit.
Arguments :
1. value : Used for storing the values in which is converted or to be convered into different units.
Temperature Module -> Designed by Abhay Chaudhary
"""
# main code data and structure below
# Also contains the formular regarding unit conversion
rankine = value / 1.8
return rankine
def rank2reaumur(self,value):
"""
:: Temperature Module ::
Class : Rankine
Function : rank2reaumur(self,value) is used for conversion of rankine unit of temperature to reaumur unit.
Arguments :
1. value : Used for storing the values in which is converted or to be convered into different units.
Temperature Module -> Designed by Abhay Chaudhary
"""
# main code data and structure below
# Also contains the formular regarding unit conversion
rankine = ((value - 32) - 459) / 2.25
return rankine
class Reaumur:
reaumur = 0
# ------------------------------------------ Initial Methods of Reaumur Class --------------------------------------------
# ------------------------------------------------------------------------------------------------------------------------
# This class and its methods has its original phase with its overall data on Github Repository : @ackwolver335 -----------
def __init__(self):
"""
:: Temperature Module ::
Class : Reaumur
Function : __init__(self) it don't contains different arguments at its initial phase
We are getting the data at the runtime of the Program.
Also the available data members of this one is explained below :
1. celsius : This is generally used in order to store the value after getting converted in the required unit in Temperature.
Temperature Module -> Designed by Abhay Chaudhary.
"""
# Here we have a general use of pass keyword as we don't have further code in __init__() method.
pass
def reaum2F(self,value):
"""
:: Temperature Module ::
Class : Reaumur
Function : reaum2F(self,value) is used for conversion of reaumur unit of temperature to fahrenheit unit.
Arguments :
1. value : Used for storing the values in which is converted or to be convered into different units.
Temperature Module -> Designed by Abhay Chaudhary
"""
# main code data and structure below
# Also contains the formular regarding unit conversion
reaumur = (value * 2.25) + 32
return reaumur
def reaum2C(self,value):
"""
:: Temperature Module ::
Class : Reaumur
Function : reaum2C(self,value) is used for conversion of reaumur unit of temperature to celsius unit.
Arguments :
1. value : Used for storing the values in which is converted or to be convered into different units.
Temperature Module -> Designed by Abhay Chaudhary
"""
# main code data and structure below
# Also contains the formular regarding unit conversion
reaumur = value * 1.25
return reaumur
def reaum2K(self,value):
"""
:: Temperature Module ::
Class : Reaumur
Function : reaum2K(self,value) is used for conversion of reaumur unit of temperature to kelvin unit.
Arguments :
1. value : Used for storing the values in which is converted or to be convered into different units.
Temperature Module -> Designed by Abhay Chaudhary
"""
# main code data and structure below
# Also contains the formular regarding unit conversion
reaumur = (value * 1.25) + 273.15
return reaumur
def reaum2rank(self,value):
"""
:: Temperature Module ::
Class : Reaumur
Function : reaum2rank(self,value) is used for conversion of reaumur unit of temperature to rankine unit.
Arguments :
1. value : Used for storing the values in which is converted or to be convered into different units.
Temperature Module -> Designed by Abhay Chaudhary
"""
# main code data and structure below
# Also contains the formular regarding unit conversion
reaumur = ((value * 2.25) + 32) + 459
return reaumur