羅伊晴python,print,input,字串[::-1]
w3schools
微軟Visiual Studio Code編寫python程式
微軟Visiual Studio Code編寫python程式碼
#註解:羅伊晴2023/2/20
print("0123456789")
a = "零一二三四五六七八九"
print(a)
b = a[2:9:] #方法取字串a第3到第8字元
print(b)
c = a[2:9:2]
print(c)
d = a[9:2:-1]
print(d)
a = input("輸入字串: ")
print("原來字串: "+a)
b = a[::-1]
print("反向字串: "+b)
心得
print在Java輸出System.out.print(); [::2] = 要全部的字串
有心得 很優秀
回覆刪除