For the time being, I'm going to put out the answer of 01 this time.
Python is something fresh and fun because it's usually Java.
01 Take out the 1st, 3rd, 5th, and 7th characters of the character string "Patatokukashi" and get the concatenated character string.
This is the problem this time. Thank you for taking care of the slices this time as well.
01.py
str = u"Patatoku Kashii"
print (str[::2])
I'm writing code like this. It's short for the time being, and I think this is fine, but I feel like I can devise it.
Edited because you pointed out
In python, there is a function called str, and if you use str (123), there is a function that converts it to '123'. In other words, when using this writing method in an environment closer to the actual production, it will be in a situation where you can not use str () even though you want to use it.
So
01.py
s = u"Patatoku Kashii"
print (s[::2])
You should do it like this. The naming of variables and classes is quite appropriate, and Java's habit cannot be removed, so it will be cured. .. .. ..
100 knocks for language processing: 100 knocks for language processing 100 language processing knocks in Python: Qiita
Recommended Posts