Implementing a simple algorithm in Python 2

Let's replace the following alphabets with numbers according to the rules. 157074.jpg

Answer

input_line = input()
translate = input_line.replace('D', '8').replace('F', '3').replace('K', '1').replace('N', '0').replace('W', '9').replace('Z', '4').replace('Q', '2').replace('J', '7').replace('V', '6').replace('T', '5')
print(translate)
#input
DSJKFHSJHAJK

#output
8S713HS7HA71

Replaced using python replace.

It's a very dirty writing style, but I was able to convert it, so for the time being, Yoshi!

Recommended Posts

Implementing a simple algorithm in Python 2
Run a simple algorithm in Python
Write a simple greedy algorithm in Python
Write A * (A-star) algorithm in Python
A simple HTTP client implemented in Python
Create a simple GUI app in Python
Write a simple Vim Plugin in Python 3
A * algorithm (Python edition)
Simple gRPC in Python
Algorithm in Python (Bellman-Ford)
Algorithm in Python (Dijkstra's algorithm)
Set up a simple HTTPS server in Python 3
A simple Pub / Sub program note in Python
Create a simple momentum investment model in Python
Set up a simple SMTP server in Python
Take a screenshot in Python
Create a function in Python
Create a dictionary in Python
Algorithm in Python (binary search)
Make a bookmarklet in Python
Try implementing Yubaba in Python 3
Simple regression analysis in Python
Implement Dijkstra's Algorithm in python
Draw a heart in Python
Simple IRC client in python
Make a simple Slackbot with interactive button in python
2. Multivariate analysis spelled out in Python 1-2. Simple regression analysis (algorithm)
Algorithm in Python (breadth-first search, bfs)
Maybe in a python (original title: Maybe in Python)
Write a binary search in Python
I made a simple typing game with tkinter in Python
[python] Manage functions in a list
Hit a command in Python (Windows)
Simple OAuth 2 in Python (urllib + oauthlib)
Sorting algorithm and implementation in Python
Create a DI Container in Python
It's hard to write a very simple algorithm in php
Draw a scatterplot matrix in python
Try implementing extension method in python
ABC166 in Python A ~ C problem
Python algorithm
Develop an investment algorithm in Python 2
A simple way to avoid multiple for loops in Python
Create a binary file in Python
Algorithm in Python (depth-first search, dfs)
Write a pie chart in Python
Create a Kubernetes Operator in Python
Algorithm (segment tree) in Python (practice)
Solve ABC037 A ~ C in Python
Draw a CNN diagram in Python
Create a random string in Python
Simple gacha logic written in Python
Schedule a Zoom meeting in Python
When writing a program in Python
Generate a first class collection in Python
Spiral book in Python! Python with a spiral book! (Chapter 14 ~)
Solve ABC175 A, B, C in Python
Creating a simple PowerPoint file with Python
Use print in a Python2 lambda expression
Do a non-recursive Euler Tour in Python
Try implementing a Shazam-like voice fingerprint algorithm