During this time, I tried Checkio, which I heard from my senior at work, and was addicted to it ~~ (it was interesting and the time melted near the deadline for my thesis) ~~, so I would like to introduce it.
Learning about python and JavaScript while solving problems. If you answer the question correctly, you will be able to solve the next question, so you can proceed completely like a game. ~~ (This is the cause of melting time) ~~
I think Progate is famous for learning python, but it costs money as the lesson progresses ... Of course, you can take good lessons as much as you spend, so I think it's natural to spend money.
Also, Checkio solves problems on the web, so I think one of the attractions is that you don't have to build a Python environment that you tend to get hooked on.
In addition, Checkio can post the code you write, get comments from those who see it, and see the code posted by others for the questions you answered correctly! I think it will be a good study just to see this!
Some difficult problems have hints, and you can solve them based on the hints, so it is recommended for those who are new to Python.
This is a completely personal opinion, but since the problem sentences are in English, I have a little trouble with that ... ~~ (It's a good story to study English) ~~ I am writing this article with a faint expectation that the Japanese version will be released if the number of Japanese people who read this starts and the population of Japanese people increases ...
Checkio From here, you can jump to the page and log in with your Github account, Facebook account, or Google account.
Some people may want to know what the problem is before logging in, so here's an example of what's actually happening in Checkio. If you put too many examples, you won't be able to enjoy it, so I'll just ask one question.
Problem Determine if the password is at least 10 characters long and contains all uppercase, lowercase and numbers.
def checkio(data):
#I will write the number of volumes that will be the answer in this part.
if len(data) < 10:
#Exclude those less than 10 in length
return False
elif data.isalpha():
#Exclude all alphabets
return False
elif data.islower():
#Exclude all lowercase ones
return False
elif data.isupper():
#Exclude all capital letters
return False
elif data.isdigit():
#Exclude all numbers
return False
else:
#What's left is a good password
return True
#Some hints
#Just check all conditions
if __name__ == '__main__':
#These "asserts" using only for self-checking and not necessary for auto-testing
assert checkio('A1213pokl') == False, "1st example"
assert checkio('bAse730onE4') == True, "2nd example"
assert checkio('asasasasasasasaas') == False, "3rd example"
assert checkio('QWERTYqwerty') == False, "4th example"
assert checkio('123456123456') == False, "5th example"
assert checkio('QwErTy911poqqqq') == True, "6th example"
print("Coding complete? Click 'Check' to review your tests and earn cool rewards!")
The above is my answer. By the way, the code with the highest ranking among the posted codes is as follows
import re
DIGIT_RE = re.compile('\d')
UPPER_CASE_RE = re.compile('[A-Z]')
LOWER_CASE_RE = re.compile('[a-z]')
def checkio(data):
"""
Return True if password strong and False if not
A password is strong if it contains at least 10 symbols,
and one digit, one upper case and one lower case letter.
"""
if len(data) < 10:
return False
if not DIGIT_RE.search(data):
return False
if not UPPER_CASE_RE.search(data):
return False
if not LOWER_CASE_RE.search(data):
return False
return True
if __name__ == '__main__':
assert checkio('A1213pokl')==False, 'First'
assert checkio('bAse730onE4')==True, 'Second'
assert checkio('asasasasasasasaas')==False, 'Third'
assert checkio('QWERTYqwerty')==False, 'Fourth'
assert checkio('123456123456')==False, 'Fifth'
assert checkio('QwErTy911poqqqq')==True, 'Sixth'
print('All ok')
You're using regular expressions. Certainly, it may be easier to understand what you are doing at a glance.
Well, I think it will be a learning experience to see the code written by other people like this.
So far, we have introduced Checkio. If you have any interest in it, please try it! ~~ (It's free so lol) ~~ If you feel like trying it out, please recommend it to others! Finally, I will post the link only once again. Checkio
Recommended Posts