[CpawCTF] Q14. [PPC] Try writing Sort! In Python

https://ctf.cpaw.site/questions.php?qnum=14 It is a memo to solve Q14 of Cpaw CTF in Python

It seems that the array is sorted in descending order I want to write it in Python because it's a big deal If you write the result first, it looks like this

list = [15,1,93,52,66,31,87,0,42,77,46,24,99,10,19,36,27,4,58,76,2,81,50,102,33,94,20,14,80,82,49,41,12,143,121,7,111,100,60,55,108,34,150,103,109,130,25,54,57,159,136,110,3,167,119,72,18,151,105,171,160,144,85,201,193,188,190,146,210,211,63,207]
sort_list = sorted(list, reverse=True)
answer = ''.join(map(str,sort_list))
print(answer)

First join

answer = ''.join(sort_list)

I got the following error

TypeError: sequence item 0: expected str instance, int found

It seems that join must be str type, and it seems that you can convert the type with map () as shown below, so when I tried it, I stopped throwing an error

answer = ''.join(map(str,sort_list))

If you look it up, it might be easier, but I solved it for the time being, so I'll leave it as a memo (´ ・ ω ・ `)

Recommended Posts

[CpawCTF] Q14. [PPC] Try writing Sort! In Python
Bubble sort in Python
A memo about writing merge sort in Python
Try gRPC in Python
Custom sort in Python3
Try 9 slices in Python
Naturally sort Path in Python
Try LINE Notify in Python
python in mongodb in descending sort
Try implementing Yubaba in Python 3
Sort by date in python
Try implementing extension method in python
Try using LevelDB in Python (plyvel)
Let's try Fizz Buzz in Python
Try to calculate Trace in Python
Try PLC register access in Python
Sort large text files in Python
Reading and writing text in Python
Try using Leap Motion in Python
When writing a program in Python
When specifying multiple keys in python sort
New in Python 3.9 (2)-Sort directed acyclic graphs in Python
Try logging in to qiita with Python
Try using the Wunderlist API in Python
Try sending a SYN packet in Python
Try drawing a simple animation in Python
Try python
[Python] Sort
Template for writing batch scripts in python
Python # sort
Quickly try Microsoft's Face API in Python
Implemented Stooge sort in Python3 (Bubble sort & Quicksort)
Try text mining your diary in Python
Try hitting the YouTube API in Python
Try a functional programming pipe in Python
Try something like Python for-else in Ruby
[Tips] Easy-to-read writing when connecting functions in Python
First steps to try Google CloudVision in Python
Try to implement Oni Maitsuji Miserable in python
Try to calculate a statistical problem in Python
3.14 π day, so try to output in Python
[Python] Sort the list of pathlib.Path in natural sort
Try auto to automatically price Enums in Python 3.6
Try implementing two stacks in one array in Python
[Cloudian # 7] Try deleting the bucket in Python (boto3)
When I try matplotlib in Python, it says'cairo.Context'
Try using the BitFlyer Ligntning API in Python
Reading and writing CSV and JSON files in Python
[Neta] Thread-safe Sleep Sort function in Python (threading)
Try installing GeoSpark (Apache Sedona) in Python environment
The 18th offline real-time writing problem in Python
Try to calculate RPN in Python (for beginners)
Try working with Mongo in Python on Mac
Split files when writing vim plugin in python
Sort list elements in a specified order in Python
I tried to implement selection sort in python
Try implementing the Monte Carlo method in Python
The 19th offline real-time writing problem in Python
Try using ChatWork API and Qiita API in Python
Try using the DropBox Core API in Python
[Python] Manipulating elements in a list (array) [Sort]