ねこきっくぱんちのメモ帳

ITに関することいろいろめも。たまにアニメ。

Python

checkio home MonkeyTyping

checkio home MonkeyTyping def count_words(text, words): cnt = 0 for w in words: if (w in text.lower()) == True: cnt += 1 else: continue #pass return cnt if __name__ == '__main__': #These "asserts" using only for self-checking and not neces…

checkio home Non-Unique Elements

checkio home Non-Unique Elements def checkio(data): list = data list_cnt = [] for n in list: if list.count(n) > 1: list_cnt.append(n) else: continue return list_cnt #Some hints #You can use list.count(element) method for counting. #Create …

checkio home theMostWantedLetter

checkio home theMostWantedLetter from collections import Counter import re def checkio(text): #1.文字列操作(データ加工) str = text.lower() #大文字から小文字 str2 = str.replace(" ", "") #空白を削除 str3 = re.sub(r'[!-/:-@[-`{-~]', "", str2)…

checkio home housepassword

checkio home housepassword import re def checkio(data): if len(data) >= 10 and re.search("[0-9]",data) and re.search("[a-z]",data) and re.search("[A-Z]",data): return True else: return False if __name__ == '__main__': #These "asserts" usin…

Django チュートリアル1

下記参照元のチュートリアルメモ - //Python 3.6.4 //venvをつかったローカル環境構築(mac) //pip install django==1.11 - ・virtual environment python3 -m venv myvenv //ディレクトリ作成 source myvenv/bin/activate //アクティベート・Djangoインスト…