20190203

Python 入門資料

Python 入門資料

............................................................
Keywords: Python, Introduction, Fundamental, Jupyter, ... .
............................................................

數字 a = 123
字串 a = '123'
............................................................

INPUT :讓使用者輸入資料,形態為字串。
..........

In[]:
a = input() # a from input data.
print ('a =', a)

Out[]:
123
a = 123
..........

In[]:
a = input('From your input data:') # a from input data.
print ('a =', a)

Out[]:
From your input data:156 a = 156

..........

# 四則運算
a = int(input()) # a from input data.
print('a is = ', a)
b = int(input()) # b from input data.
print('b is = ', b)
print ('a + b = ',a+b)
print ('a - b = ',a-b)
print ('a * b = ',a*b)
print ('a/b = ',a/b)

..........

# for loop
for i in range (0,10): # range is from 0 to n-1. print(i)

Out[] = 0123456789
............................................................

REFERENCE:

............................................................

沒有留言:

張貼留言