MCPcopy Create free account
hub / github.com/geekcomputers/Python / ask_side

Method ask_side

area_of_square_app.py:58–73  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

56 # Want to add a while loop asking for the input.
57 # Also have an option to ask the user in true mode or in repeat mode.
58 def ask_side(self):
59 # if true bool then while if int or float then for loop.
60 # I will have to learn inheritance and polymorphism.
61 condition = 3
62 # condition = True
63 if condition == True and isinstance(condition, bool):
64 while condition:
65 n = input("Enter the side of the square: ")
66 self.side = float(n)
67 elif isinstance(condition, (int, float)):
68 for i in range(_=condition):
69 n = input("Enter the side of the square: ")
70 self.side = float(n)
71 # n = input("Enter the side of the square: ")
72 # self.side = float(n)
73 # return
74
75 def truncate_decimals(self):
76 return (

Callers 1

__init__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected