-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_example.py
More file actions
36 lines (29 loc) · 777 Bytes
/
Copy pathtest_example.py
File metadata and controls
36 lines (29 loc) · 777 Bytes
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
#!/usr/bin/env python3
"""
Simple example Python script to demonstrate running with uv
"""
def greet(name):
"""Return a greeting message"""
return f"Hello, {name}!"
def calculate_factorial(n):
"""Calculate factorial of n"""
if n <= 1:
return 1
return n * calculate_factorial(n - 1)
def main():
print("=== Python Script Running with UV ===")
print()
# Test greeting
print(greet("World"))
print(greet("Developer"))
print()
# Test factorial calculation
numbers = [5, 7, 10]
print("Factorial calculations:")
for num in numbers:
result = calculate_factorial(num)
print(f" {num}! = {result}")
print()
print("✓ Script completed successfully!")
if __name__ == "__main__":
main()