Solve character matches (equivalent to paiza rank D) in Python

at first

I was solving a collection of paiza level-up questions, but I didn't have a model answer, so I made it myself. The language is Python3.

problem

Paiza's skill check sample question Character matching (equivalent to paiza rank D) https://paiza.jp/works/mondai/skillcheck_sample/diff_str?language_uid=python3 I couldn't see the problem statement without logging in. Registration is free and can be done immediately, so I recommend you to register for the time being.

Answer code

diff_str.py


#Save the entered string
a = input()
b = input()

#Compare strings and output answer
if a == b:
    print("OK")
else:
    print("NG")

Answer code 2

When I tried my best to write it in one sentence, it became like this. Is this common?

diff_str.py


print("OK" if input() == input() else "NG")

reference

https://qiita.com/KoyanagiHitoshi/items/3286fbc65d56dd67737c

Finally

Feel free to comment if you have any questions. I will answer as much as possible!

Recommended Posts

Solve character matches (equivalent to paiza rank D) in Python
Solve addition (equivalent to paiza rank D) in Python
Solve the smallest value in Python (equivalent to paiza rank D)
Solve island hunting (equivalent to paiza rank S) in Python
Solve word counts (equivalent to paiza rank C) in Python
Solve mod7 fortune-telling (equivalent to paiza rank S) in Python
Solve Fizz Buzz (equivalent to paiza rank C) in Python
[With commentary] Solve Fizz Buzz (equivalent to paiza rank C) in Python
Solve ABC175 D in Python
ABC 157 D --Solve Friend Suggestions in Python!
I wanted to solve ABC159 in Python
Solve ABC165 A, B, D in Python
Solve ABC168D in Python
Solve ABC167-D in Python
Solve ABC146-C in Python
Solve ABC098-C in Python
Solve ABC169 in Python
Solve ABC160-E in Python
[Python] How to expand variables in a character string
To do the equivalent of Ruby's ObjectSpace._id2ref in Python
To flush stdout in Python
Login to website in Python
Processing of python3 that seems to be usable in paiza
Solve ABC176 E in Python
Solve Wooldridge exercises in Python
Speech to speech in python [text to speech]
13th Offline Real-time How to Solve Writing Problems in Python
Solve optimization problems in Python
How to develop in Python
Character code learned in Python
Post to Slack in Python
[Introduction to Python] How to output a character string in a Print statement
The 17th Offline Real-time How to Solve Writing Problems in Python
How to write offline real time Solve E04 problems in Python
I wanted to solve the ABC164 A ~ D problem with Python
How to display legend marks in one with Python 2D plot
Convert markdown to PDF in Python
How to collect images in Python
Solve ABC166 A ~ D with Python
How to use SQLite in Python
Solve Atcoder ABC169 A-D in Python
In the python command python points to python3.8
Solve ABC036 A ~ C in Python
How to use Mysql in python
How to wrap C in Python
How to use ChemSpider in Python
6 ways to string objects in Python
How to use PubChem in Python
I'm addicted to Python 2D lists
Solve ABC037 A ~ C in Python
Solve ordinary differential equations in Python
How to handle Japanese in Python
An alternative to `pause` in Python
I tried to solve AtCoder's depth-first search (DFS) in Python (result: TLE ...)
[Introduction to Python] Thorough explanation of the character string type used in Python!
[At Coder] What I did to reach the green rank in Python
[Python, Julia] 3D display in Jupyter-Mayavi library
I tried to implement PLSA in Python
[Introduction to Python] How to use class in Python?
Solve ABC175 A, B, C in Python
Try logging in to qiita with Python