Test Informed Learning with Examples

Logo

Repository with assignments using the Test Informed Learning with Examples (TILE) method to integrate testing into existing programming courses for free.

Menu

LinkedIN Community

Join our LinkedIN Community.

Creating files with a random number of random numbers

Write a Python program that allows you to generate a certain number of files with a random number (between 1 and 10) of random real numbers (between 1.00 and 200.00). The numbers must be aligned to the right and with 2 decimal places. You can import random and use randint to randomly generate integers, and uniform to randomly generate real numbers.

Your program:

For example:

>>> %Run 
    How many files?: 4
    What is the base name?: file
>>> 

It can generate for example:

file1 file2 file3 file4
133.25 29.92 50.08 6.64
159.93 199.44 59.34 136.33
162.02 158.01 109.88 32.02
23.26 153.48 56.16
147.50   195.16 97.67
  51.95 160.56
    86.55
    153.28