count positive, negative numbers and compute Average of numbers

number = eval(input(“Enter an integer, the input ends if it is 0: “)) count = 0 total = 0 numberOfPositive = 0 numberOfNegative = 0 while number != 0: count += 1 if number > 0: numberOfPositive += 1 else: numberOfNegative += 1 total = total + number number = eval(input(“Enter an integer, the input … Read morecount positive, negative numbers and compute Average of numbers

simulate a random walk

This┬áprogram that simulates a random walk in a lattice import turtle from random import randint turtle.speed(1) #Set turtle speed to sloweast # Draw 16-by-16 lattice turtle.color(“gray”) # Color for lattice x = -80 for y in range(-80, 80 + 1, 10): turtle.penup() turtle.goto(x, y) # Draw a horizontal line turtle.pendown() turtle.forward(160) y = 80 turtle.right(90) … Read moresimulate a random walk