0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

windowsでpython 基本②

Posted at

#演算

###変数への値の代入
 変数名=値
 ex)sum=10 、 animal='dog'

 変数に格納されている値を確認するにはprint(変数名)で確認できる!

###演算子
 +:足し算
 -:引き算
 *:掛け算
 /:割り算
 //:小数点以下切り捨ての割り算
 %:余剰(余りを出す)
 **:べき乗

###複合代入演算子
 +=:足し算  ex)a+=2 → a=a+2
 -=:引き算
 *=:掛け算
 /=:割り算
 //=:小数点以下切り捨ての割り算
 %=:余剰
 **=:べき乗

###文字列の連結

#####文字列の連結
 '文字列A'+'文字列B'
  ex)>>>'とも'+'だち'
    ともだち

#####文字列の繰り返し連結
 '文字列'*正の整数
  ex)>>>'ab'*4
    abababab

###文字列の長さの取得
 len('文字列')
  ex)>>>len('2222222')
    7

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?