Python Pt. 1
After completing this workshop, we had given c challenge to code a function.
Problem
Define a function which take a length as a arguments and return the same length of array containing the random numbers.
Solution
from random import randint
def generate_random_list(length):
result = [randint(0, 100) for i in range(length)]
return result
if __name__ == '__main__':
print(generate_random_list(10))
Log in or sign up for Devpost to join the conversation.