Skip to content
Snippets Groups Projects
Commit ea4a1e41 authored by MICHOUD KEVIN's avatar MICHOUD KEVIN
Browse files

Merge branch 'dev' into 'main'

random script

See merge request !5
parents 7bcddb34 db739d13
Branches main
1 merge request!5random script
import random
# Generate a list of random numbers
def generate_random_numbers(count, start, end):
random_numbers = [random.randint(start, end) for _ in range(count)]
return random_numbers
# Calculate sum, average, maximum, and minimum of the list
def calculate_statistics(numbers):
total_sum = sum(numbers)
average = total_sum / len(numbers)
maximum = max(numbers)
minimum = min(numbers)
return average, maximum, minimum
# Main function
def main():
count = 10 # Number of random numbers to generate
start = 1 # Lower bound of random number range
end = 100 # Upper bound of random number range
random_numbers = generate_random_numbers(count, start, end)
print("Generated Random Numbers:", random_numbers)
average, maximum, minimum = calculate_statistics(random_numbers)
print(f"Average: {average}")
print(f"Maximum: {maximum}")
print(f"Minimum: {minimum}")
if __name__ == "__main__":
main()
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment