GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — StarterLearningPython/newcodes/round_float.py at master · cafew/StarterLearningPython Expand file tree/ Copy pathround_float.pyMore file actions 17 lines (13 loc) · 361 Bytes / Copy pathround_float.pyFile metadata and controls17 lines (13 loc) · 361 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 #!/usr/bin/env python # coding=utf-8 class RoundFloat: def __init__(self, val): assert isinstance(val, float), "value must be a float." self.value = round(val, 2) def __str__(self): return "{:.2f}".format(self.value) __repr__ = __str__ if __name__ == "__main__": r = RoundFloat(2.185) print(r) print(type(r)) |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |