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

This commit is contained in:
Bradley committed 2022-12-10 17:18:44 -05:00
1 parent 0aa0875c42
commit 543bc78e51
21 files changed
+161 -3

No files matched your search

@@ -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.
@@ -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))
Whitespace-only changes.
+10
View File
@@ -0,0 +1,10 @@
import random
for i in range(10):
print("Index Number: " + str(i))
for i in range(5):
print("Int Value " + str(i + 1) + ": " + str(random.randint(1, 100)))
print("Float Value " + str(i + 1) + ": " + str(random.random() * 100 + 1))
print("Boolean Value " + str(i + 1) + ": " + str(True if random.random() > .5 else False))