We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent eb54e83 commit 35a6c76Copy full SHA for 35a6c76
README.md
@@ -22,6 +22,13 @@ This project was built using these tools:
22
make install
23
```
24
25
+### Examples
26
+
27
+```bash
28
+uv run hexlet-python-package 5
29
30
+2.5
31
+```
32
33
### Run tests
34
hexlet_python_package/scripts/main.py
@@ -4,7 +4,17 @@
4
5
6
def main():
7
- print(half(float(sys.argv[-1])))
+ if len(sys.argv) < 2:
8
+ print("Error: You must provide a number as an argument.")
9
+ return
10
11
+ possible_number = sys.argv[1]
12
13
+ try:
14
+ number = float(possible_number)
15
+ print(half(number))
16
+ except ValueError:
17
+ print(f"Error: '{possible_number}' is not a valid number.")
18
19
20
if __name__ == "__main__":
0 commit comments