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.
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.
diff_str.py
#Save the entered string
a = input()
b = input()
#Compare strings and output answer
if a == b:
print("OK")
else:
print("NG")
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")
https://qiita.com/KoyanagiHitoshi/items/3286fbc65d56dd67737c
Feel free to comment if you have any questions. I will answer as much as possible!
Recommended Posts