Adding as many examples as I've converted so far.

This commit is contained in:
2022-12-10 17:18:44 -05:00
parent 0aa0875c42
commit 543bc78e51
21 changed files with 161 additions and 3 deletions

View File

@@ -0,0 +1 @@
Write a program that requests an integer from the user, and prints that many random numbers AND prints hte sum and average of those numbers.

View File

@@ -0,0 +1,15 @@
import random
numberToRandomize = int(input("Number of random values to create: "))
sum = 0.0
for i in range(numberToRandomize):
randomNumber = random.random() * 100 + 1
print("Random Number " + (i + 1) + ": " + str(randomNumber))
sum += randomNumber
print("Sum = " + str(sum))
print("Average = " + str(sum / numberToRandomize))