tests
This commit is contained in:
parent
f92f5ef7f6
commit
307c51539c
10 changed files with 252 additions and 1 deletions
30
test/ruby/33.in
Normal file
30
test/ruby/33.in
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
def analyze_numbers(numbers):
|
||||
if not numbers:
|
||||
return 0, 0, 0
|
||||
|
||||
total = sum(numbers)
|
||||
average = total / len(numbers)
|
||||
|
||||
positive_count = 0
|
||||
for num in numbers:
|
||||
if num > 0:
|
||||
positive_count += 1
|
||||
|
||||
return total, average, positive_count
|
||||
|
||||
def get_coordinates():
|
||||
x = 10
|
||||
y = 20
|
||||
z = 30
|
||||
return x, y, z
|
||||
|
||||
data = [3, -1, 4, -2, 0, 5, -3]
|
||||
total, avg, positives = analyze_numbers(data)
|
||||
|
||||
print(f"Numbers: {data}")
|
||||
print(f"Total: {total}")
|
||||
print(f"Average: {avg:.2f}")
|
||||
print(f"Positive numbers: {positives}")
|
||||
|
||||
x, y, z = get_coordinates()
|
||||
print(f"\nCoordinates: x={x}, y={y}, z={z}")
|
||||
Loading…
Add table
Add a link
Reference in a new issue