Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

whats the answer in python ? Write a function randomNumbers with two parameters upTo and num. The function will generate num integers each between 1

whats the answer in python ?
image text in transcribed
Write a function randomNumbers with two parameters upTo and num. The function will generate num integers each between 1 and upTo. These integers should be added to a set (not a listi). At the end the function returns the number of unique numbers generated (which corresponds to the size of the set). If the function returns the same as num, it means that all generated numbers were different, but if the number returned is less than num than it means that a random number was selected more than once. If you try the function with upIo =365, then this is the same as choosing birthdates randomly. What value should you give to num to have a high chance of getting the same birthday twice (the function returns less than num)? Try for example, 10, 25, 50, 100 . Sample run: While drawing 10 randoa numbers between 1 and 365 , we obtained 18 different numbers, and collusions. While drawing 25 random numbers between 1 and 365, we obtained 24 different numbers, and 1 collustons. While drawing 56 random numbers between 1 and 365 , we obtained 45 different numbers, and 5 collusions. While drawing 16e random numbers between 1 and 365, we obtained 89 different- numbers, and 11 collusions. While drawing 180 randon numbers between 1 and 365 , we obtained 146 different numbers, and 34 collusions

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Using Entity Relationship Diagrams

Authors: Sikha Saha Bagui, Richard Walsh Earp

3rd Edition

103201718X, 978-1032017181

More Books

Students also viewed these Databases questions

Question

Write a note on job design.

Answered: 1 week ago

Question

Compute the derivative of f(x)cos(-4/5x)

Answered: 1 week ago

Question

Discuss the process involved in selection.

Answered: 1 week ago

Question

Differentiate tan(7x+9x-2.5)

Answered: 1 week ago

Question

How do Excel Pivot Tables handle data from non OLAP databases?

Answered: 1 week ago