Output in the form of a python array


I'm just studying python. For now, I'm writing programming to create an array of random numbers. Random numbers are coming out, but I couldn't get the shape I wanted. The code I wrote is as follows.

import numpy as np

n_zero=input('Insert the amount of 0: ') n_one =input('Insert the amount of 1: ') n_two =input('Insert the amount of 2: ') n_three = input('Insert the amount of 3: ')

data = [0]*n_zero + [1]*n_one + [2]*n_two + [3]*n_three np.random.shuffle(data) print(data)

The output result is

Insert the amount of 0: 6 Insert the amount of 1: 2 Insert the amount of 2: 1 Insert the amount of 3: 2 [3, 0, 0, 0, 1, 0, 1, 0, 3, 0, 2]

The result you want is like this. 30001010302

The comma and unbracketed form is the desired result.

Thank you.

Recommended Posts

Output in the form of a python array
Read the standard output of a subprocess line by line in Python
Output the number of CPU cores in Python
Make a copy of the list in Python
A reminder about the implementation of recommendations in Python
Find out the apparent width of a string in python
Change the standard output destination to a file in Python
Get the number of specific elements in a python list
[Note] Import of a file in the parent directory in Python
Find the eigenvalues of a real symmetric matrix in Python
[Python] Change the text color and background color of a specific keyword in print output
Check the behavior of destructor in Python
Output tree structure of files in Python
Write the test in a python docstring
Run the Python interpreter in a script
The result of installing python in Anaconda
[python] [meta] Is the type of python a type?
In search of the fastest FizzBuzz in Python
The story of blackjack A processing (python)
[Python] Combine all the elements in the array
How to determine the existence of a selenium element in Python
How to check the memory size of a variable in Python
Output the contents of ~ .xlsx in the folder to HTML with Python
How to check the memory size of a dictionary in Python
A function that measures the processing time of a method in python
Get the number of readers of a treatise on Mendeley in Python
Draw a graph of a quadratic function in Python
Get a capture of the entire web page in Selenium Python VBA
[Python] Get the files in a folder with Python
[Python] Sort the list of pathlib.Path in natural sort
Match the distribution of each group in Python
View the result of geometry processing in Python
Check the in-memory bytes of a floating point number float in Python
the zen of Python
Find the number of days in a month
Rewriting elements in a loop of lists (Python)
Read the output of subprocess.Popen in real time
Test & Debug Tips: Create a file of the specified size in Python
A note about the python version of python virtualenv
Find the divisor of the value entered in python
Submit in [Python] form
Find the solution of the nth-order equation in python
Receive a list of the results of parallel processing in Python with starmap
[Python numpy] Dynamically specify the index of the array
The story of reading HSPICE data in Python
Make a joyplot-like plot of R in python
[Note] About the role of underscore "_" in Python
About the behavior of Model.get_or_create () of peewee in Python
Solving the equation of motion in Python (odeint)
[Python] A rough understanding of the logging module
Japanese output in Python
Get a glimpse of machine learning in Python
[Python] Find the transposed matrix in a comprehension
Get a datetime instance at any time of the day in Python
I made a program to check the size of a file in Python
A well-prepared record of data analysis in Python
Basics of python: Output
A discussion of the strengths and weaknesses of Python
Speed evaluation of CSV file output in Python
[Python] Manipulating elements in a list (array) [Sort]
How to sort by specifying a column in the Python Numpy array.