iT邦幫忙

0

[筆記系列]Python入門中的入門

#練習一 hello world
print("hello world1")
text = "HELLO WORLD"
print(text)

#這也是註解
#練習二 使用者輸入
"""""""""這是註解
i = int(input())
if i > 100:
    print('i>100')
elif i == 0:
    print("i = 0")
else:
    print("i<100")
"""""""""

#練習三 for迴圈
ss = 0
for n in range(0,100):
    ss = ss + n
print(ss)

#練習四 function
def GetNum(x,y):
    if x > y:
        return x
    elif x < y:
        return y
print(GetNum(5,6))
print(GetNum(10,6))

#練習五
class MyClass:
    def SetName(self,name):
        self.name = name
    def GetName(self):
        return self.name
test = MyClass()
test.SetName('你的名字我的名字')
print(test.GetName())

#練習六

#練習七

圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言