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

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

VBA1 Book1の内容をコピーし、Boo2へペースト

■準備
excel(mac)
・環境設定>リボンとツールバー>メインタブ選択>開発にチェックを入れ適用

■マクロ
・ブック1の一部をコピー
・ブック2を開き、ペースト

■なかみ

Sub Macro1()
'
' Macro1 Macro
'

'
    Range("A1:A5").Select
    Selection.Copy
    Workbooks.Open FileName:= _
        "/Users/userName/Desktop/data.xlsx"
    Range("B1").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
End Sub

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 necessary for auto-testing
    assert count_words("How aresjfhdskfhskd you?", {"how", "are", "you", "hello"}) == 3, "Example"
    assert count_words("Bananas, give me bananas!!!", {"banana", "bananas"}) == 2, "BANANAS!"
    assert count_words("Lorem ipsum dolor sit amet, consectetuer adipiscing elit.",
                       {"sum", "hamlet", "infinity", "anything"}) == 1, "Weird text"
    print("Coding complete? Click 'Check' to review your tests and earn cool rewards!")

・単語が一致した場合にカウントアップ

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 new list with non-unique elements
#Loop over original list


if __name__ == "__main__":
    #These "asserts" using only for self-checking and not necessary for auto-testing
    assert list(checkio([1, 2, 3, 1, 3])) == [1, 3, 1, 3], "1st example"
    assert list(checkio([1, 2, 3, 4, 5])) == [], "2nd example"
    assert list(checkio([5, 5, 5, 5, 5])) == [5, 5, 5, 5, 5], "3rd example"
    assert list(checkio([10, 9, 10, 10, 9, 8])) == [10, 9, 10, 10, 9], "4th example"
    print("It is all good. Let's check it now")

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) #ASCII記号を削除
    str4 = re.sub(r'[0-9]', "", str3) #数字を削除
    
    #2.各文字数をカウント
    mwl = Counter(str4)
    
    #3.文字数が最大のアルファベットのみ格納
    list = []
    cnt = 0    

    for key,value in mwl.most_common(): 
        if cnt <= value:
            list.append(key)
            cnt = value
        else:
            break
    print(list)
    
    #4.アルファベット順にソート 
    list.sort()

    return list[0]

#Lorem ipsum dolor sit amet
if __name__ == '__main__':
    #These "asserts" using only for self-checking and not necessary for auto-testing
    assert checkio("Hello World!") == "l", "Hello test"
    assert checkio("How do you do?") == "o", "O is most wanted"
    assert checkio("One") == "e", "All letter only once."
    assert checkio("Oops!") == "o", "Don't forget about lower case."
    assert checkio("AAaooo!!!!") == "a", "Only letters."
    assert checkio("abe") == "a", "The First."
    print("Start the long test")
    assert checkio("a" * 9000 + "b" * 1000) == "a", "Long."
    print("The local tests are done.")

・collections>Counter

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" 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!")

正規表現のライブラリ(re)

アイカツスターズの曲で打線組んだ

アイカツスターズの曲で打線組んだ

アイカツ(いちご・あかり世代)は含んでいません。
いい曲順ではなくチームとしての打線組みです。

■打線
1(中) スタートライン!
www.youtube.com

2(二) アニマルカーニバル
www.youtube.com

3(右) MUSIC of DREAM!!!
www.youtube.com

4(左) Forever Dream
www.youtube.com

5(指) Message of a Rainbow
www.youtube.com

6(一) Dreaming bird
www.youtube.com

7(三) みつばちのキス
www.youtube.com

8(遊) おねがいメリー
www.youtube.com

9(捕) 森のひかりのピルエット
www.youtube.com


■控え
・TSU-BO-MI 〜鮮やかな未来へ〜
・MAKEOVER♡MAKEUP
・未来トランジット
・STARDOM!
・Bon Bon Voyage!
・So Beautiful Story
・The only sun light

■観客
アイカツ☆ステップ!
・episode Solo
・ハートがスキ♡ップ
スタージェット!
・1,2,Sing for You!
・Summer Tears Diary
・8月のマリーナ
・Dancing Days
POPCORN DREAMING♪
・One Step
・TSU-BO-MI 〜鮮やかな未来へ〜
・荒野の奇跡
・Miracle Force Magic
・ネバギバ☆
・裸足のルネサンス
・The only sun light

■ぱんち賞
・ハッピー☆パンチ

HerokuのgitへSourcetreeでアクセスする

■手番
1.CLIよりクローンするURLを取得
$ git remote -v
heroku https://git.heroku.com/hoge.git (fetch)
heroku https://git.heroku.com/hoge.git (push)

2.Sourcetreeより「URLからクローン」でクローンする。
※必要に応じて事前に認証トークンやAPIキーを取得

以上

■参考
http://obel.hatenablog.jp/entry/20170527/1495885222
https://devcenter.heroku.com/articles/git