1. 程式人生 > >Python 資料型別初步學習

Python 資料型別初步學習

#coding=utf-8
print("hello 你好")
 if True:
  print("answer")
  print("true")
else:
  print("test2")
  print("false")
# py 對於格式要求很嚴格,需要空格一致的縮排。建議使用統一的縮排字元。
 # py 可以使用\將一行語句分成多行顯示。通常情況在括號內不需要使用這樣的多行顯示;
 # total = item_one + item_two
 # total2 = item_one + \
# item_two
# 引號:單引號雙引號三引號;三引號基本上可以用於長文字多行註釋;單行註釋使用#;
"""
test 多行註釋
"""
raw_input("\n\nPress any key to exit")
  x="a"
  y="b"
print x
print y
print x,
print y,
  print('\n')

x=1
if (x > 1):
  print("Mike")
else:
  print("John")

#coding=utf-8
print("this is a varchar")
n = int(input("please enter a number"))
i = 1
while i <= n:
  print(i)
  i += 1
 # 迴圈語句防止死迴圈