root = sqrt(2)
print(root)

1.4142135623730951

field = rectangle(100, 60, green)
show_graphic(field)

Try it!def add(a, b):
return a + b
print(add(2, 3))

5

def circle(diameter, color):
return ellipse(diameter, diameter, color)
show_graphic(circle(75, red))

Try it!numbers = [52, -4, 17, 34, 50, 24, -17, 60, 47]
total_even = 0
for number in numbers:
if number % 2 == 0:
total_even = total_even + number
print(total_even / len(numbers))

24.0

diameters = [52, -4, 17, 34, 50, 24, -17, 60, 47]
bubbles = empty_graphic()
for diameter in diameters:
if diameter >= 0:
bubbles = beside(bubbles, circle(diameter, blue))
show_graphic(bubbles)

Try it!PyTamaro is a project created by the Lugano Computing Education Research Lab at the Software Institute of USI

Privacy Policy • Platform Version 79aacf0 (Fri, 08 Nov 2024 13:24:29 GMT)