Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Question

Python: numpy

def serial_numbers(num_players):
"""
QUESTION 2
- You are going to assign each player a serial number in the game.
- In order to make the players feel that the game is very popular with a large
player base,
you don't want the serial numbers to be consecutive.
- Instead, the serial numbers of the players must be equally spaced, starting
from 1 and going all the way up to 100 (inclusive).
- Given the number of players in the system, return a 1D numpy array of the
serial numbers for the players.
- THIS MUST BE DONE IN ONE LINE
Args:
num_players (int)
Returns:
np.array
>> serial_numbers(10)
array([1. 12. 23. 34. 45. 56. 67. 78. 89. 100.])
>> serial_numbers(12)
array([1. 10. 19. 28. 37. 46. 55. 64. 73. 82. 91. 100.])
"""
# print(serial_numbers(10))
# print(serial_numbers(12))
Expert Solution
Check Mark
Step 1

python program to print the player serial number with equal space using numpy

use the linspace() method , it returns the evenly separated values over the specified period.

syntax.

numpy.linspace(start, stop, num, endpoint, retstep, dtype)

where,

start: It represents the starting value of interval

stop: stopping value of interval

num: amount of evenly spaced sample over interval to be generated

endpoint: true value indicated the stopping value is included in interval

retstep: this is a Boolean value, represents the steps and sample between consecutive numbers

dtype: it represents the data type of array item.

* this program use only three parameters start , stop and num. see the below code

Knowledge Booster
Background pattern image
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
    SEE MORE QUESTIONS
    Recommended textbooks for you
    Text book image
    Database System Concepts
    Computer Science
    ISBN:9780078022159
    Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
    Publisher:McGraw-Hill Education
    Text book image
    Starting Out with Python (4th Edition)
    Computer Science
    ISBN:9780134444321
    Author:Tony Gaddis
    Publisher:PEARSON
    Text book image
    Digital Fundamentals (11th Edition)
    Computer Science
    ISBN:9780132737968
    Author:Thomas L. Floyd
    Publisher:PEARSON
    Text book image
    C How to Program (8th Edition)
    Computer Science
    ISBN:9780133976892
    Author:Paul J. Deitel, Harvey Deitel
    Publisher:PEARSON
    Text book image
    Database Systems: Design, Implementation, & Manag...
    Computer Science
    ISBN:9781337627900
    Author:Carlos Coronel, Steven Morris
    Publisher:Cengage Learning
    Text book image
    Programmable Logic Controllers
    Computer Science
    ISBN:9780073373843
    Author:Frank D. Petruzella
    Publisher:McGraw-Hill Education