|
| 1 | +import random |
| 2 | + |
| 3 | +f_names = ["Michael", "Christopher", "Joshua", "Matthew", "David", |
| 4 | + "Daniel", "Andrew", "Joseph", "Justin", "James", |
| 5 | + "Jessica", "Ashley", "Brittany", "Amanda", "Melissa", |
| 6 | + "Stephanie", "Jennifer", "Samantha", "Sarah", "Megan", "Lauren"] |
| 7 | + |
| 8 | +l_names = ["Smith", "Johnson", "Williams", "Jones", "Brown", |
| 9 | + "Davis", "Miller", "Wilson", "Moore", "Taylor", |
| 10 | + "Anderson", "Thomas", "Jackson", "White", "Harris", |
| 11 | + "Martin", "Thompson", "Garcia", "Martinez", "Robinson"] |
| 12 | + |
| 13 | + |
| 14 | +def create_students(how_many): |
| 15 | + for i in range(how_many): |
| 16 | + f_name = f_names[random.randint(0, len(f_names) - 1)] |
| 17 | + l_name = l_names[random.randint(0, len(l_names) - 1)] |
| 18 | + |
| 19 | + sex = random.choice(['M', 'F']) |
| 20 | + print(f"INSERT INTO student(f_name, l_name, sex) VALUES ('{f_name}', '{l_name}', '{sex}');") |
| 21 | + |
| 22 | + |
| 23 | +def create_test_scores(num_tests, num_studs): |
| 24 | + for i in range(1, num_tests+1): |
| 25 | + for j in range(1, num_studs+1): |
| 26 | + score = random.randrange(1, 25) |
| 27 | + print(f"INSERT INTO test_score VALUES ({j}, {i}, {score});") |
| 28 | + |
| 29 | + |
| 30 | +create_students(10) |
| 31 | +create_test_scores(4, 10) |
0 commit comments