Python小demo及び小記


1.メモ1(c 1.py)
#    

# 1.   (Expression)    (operator)    (operand)      。
# 2.         (=),       ;        ,     。

# a = 1
# b = 2
# c = 3
# print(a + b * c)            #7 (*       +)
# print(a or b and c)         #1 (and      or)
# d = a or b
# print(d)                    #1 (or      =)

# 3.   
    # 3.1     >      >    (not>or)
    # 3.2            (not > and >or)
    # 3.3          ;           
# a = 1
# b = 2
# c = 2
# d = (not a) or ((b + 2) == c)
# print(d)

# 4.     
    # pycharm,vscode,sublime
    # IDE Integrated Development Enviroment

# 5.vscode
    # 5.1  (     )   
        #     ==》      ==》    
    # 5.2   .py  ,    ctrl+`         ,            ctrl+`
    # 5.3          ==》       
    # 5.4    ,    
    # 5.5         python、Terminal、vscode-icons
        # python:    ,python        
        # Terminal:  vscode              ,   vscode        ,              。
        # vscode-icons:        icon  
    # 5.6   ,        ==>     F2
    # 5.7  tab               ==》      ==》    
    # snippet      (   IDE  )   (        )

# 6.Python       
    # 6.1      (;)
    # 6.2               ;
        #   {}        ,Python              
        #       :        ,          ,           
        #                   if else         for while
    # 6.3  
        # 6.3.1        #      ; ( vscode        ctrl+/ )
        # 6.3.2      ("""         """)     ; ( vscode        alt+shift+a )

# mood = True
# if mood :
#     print('go left')
# else:
#     print('go right')

    # 6.4      ,
        # 6.4.1  {}      ;
        # 6.4.2   4          ;
        # 6.4.3    ,      (      ),          ;
        # 6.4.4           ,       
        # 6.4.5  Python        ;
            #          (             ,             )
            #     (      ),     
        # 6.4.6 if                (             bool   )
# a = 1
# b = 2
# c = 2
# if a or b + 1 == c :
#     print('go left')
# else:
#     print('go right')

        # 6.4.7 if       ,else      
        # 6.4.8 if      if  
        # 6.4.9    if             ,           ,            ,         ;

    # 6.5  (  ,             )
        # constant (  ), Python           ,              
        # module(  )
    # 6.6            , else           
    # 6.7 pass    ,    
         
# 7.#    :  (+,-,*,/,%,//,**)  >    (  ,==,+=)  >    (not > and > or)

2.小demo(c 2.py)
#           

account = 'qiyue'
password = '123456'

print('please input account')
user_account = input()
print('please input password')
user_password = input()

if account == user_account and password == user_password:
    print('success')
else:
    print('fail')

3.メモ2(c 3.py)
# 1.apple orange banana shopping
#    input   str,       
# a = input()
# print(a)
# print(type(a))
# b = int(a)

# if b == 1:
#     print('apple')
# elif b == 2:
#     print('orange')
# elif b == 3:
#     print('banana')
# else:
#     print('shopping')

# 2.d   e      False,  d   e        
d = 1
e = 0
c = ''
    # 2.1    ,     if else 
# if d:
#     c = d
# else:
#     c = e

    # 2.2 Python   or   , if else    
# c = d or e

(備考:以上の内容は七月先生の学習ノートから来ており、学習としてのみ使用されています)