劉任昌開啟資料夾編寫檔案

space, slash, backslash, cr = ' ', '/', '\\', '\n'
k = 1
f = open("劉任昌.txt",'w',encoding="utf8")
for i in range(1, k+1):
    for j in range(k-i):
        f.write(space)
    f.write(slash)
    for j in range(2*i-2):
        f.write(space)
    f.write(backslash)
    for j in range(k-i):
        f.write(space)
    f.write(cr)
for i in range(1, k+1):
    for j in range(i-1):
        f.write(space)
    f.write(backslash)
    for j in range(2*k-2*i):
        f.write(space)
    f.write(slash)
    for j in range(i-1):
        f.write(space)
    f.write(cr)
f.close()

VS code開發環境截圖

程式碼

space, slash, backslash, cr = ' ', '/', '\\', '\n'
k = input('輸入規格: ')
m = input('輸入橫向規格: ')
k, m = int(k), int(m) #將字串k轉integer整數
f = open("蔡英文.txt",'w',encoding="utf8")
for i in range(1, k+1):
    for ii in range(m):
        for j in range(k-i):
            f.write(space)
        f.write(slash)
        for j in range(2*i-2):
            f.write(space)
        f.write(backslash)
        for j in range(k-i):
            f.write(space)
    f.write(cr)
for i in range(1, k+1):
    for ii in range(m):
        for j in range(i-1):
            f.write(space)
        f.write(backslash)
        for j in range(2*k-2*i):
            f.write(space)
        f.write(slash)
        for j in range(i-1):
            f.write(space)
    f.write('\n')
f.close()

381教學影片

382教學影片

留言

  1. https://keiime.blogspot.com/2024/03/0319.html

    回覆刪除
  2. https://tustning.blogspot.com/2024/03/youtube-video-player.html

    回覆刪除
  3. https://ctz642895.blogspot.com/2024/03/blog-post.html

    回覆刪除
  4. https://rrrrr-eeeee.blogspot.com/2024/03/aaaaaaaaaaaaaaa.html

    回覆刪除
  5. https://hui026.blogspot.com/2024/03/blog-post.html

    回覆刪除
  6. https://addison030.blogspot.com/2024/03/blog-post.html

    回覆刪除
  7. https://grace8166.blogspot.com/2024/03/blog-post.html

    回覆刪除
  8. https://yun0205.blogspot.com/2024/03/blog-post.html

    回覆刪除
  9. https://kk0725.blogspot.com/2024/03/blog-post.html

    回覆刪除
  10. https://www.blogger.com/blog/post/edit/2910868344786410340/1733809068979819194

    回覆刪除
  11. https://whitexd.blogspot.com/2024/03/blog-post.html

    回覆刪除
  12. https://ziyun040818.blogspot.com/2024/03/blog-post_18.html

    回覆刪除
  13. https://wilson11122.blogspot.com/2024/03/blog-post.html

    回覆刪除
  14. https://htmlcssjavascriptjavapython.blogspot.com/2024/03/blog-post.html

    回覆刪除
  15. https://rainhtmlcssjavascriptjavapython.blogspot.com/2024/03/blog-post.html

    回覆刪除
  16. https://oscarliu1688.blogspot.com/2024/03/blog-post.html

    回覆刪除
  17. https://ryanareryan.blogspot.com/2024/03/blog-post.html

    回覆刪除
  18. https://xi715.blogspot.com/2024/03/blog-post.html

    回覆刪除
  19. https://yuechen613.blogspot.com/2024/03/blog-post.html

    回覆刪除
  20. https://kevin124574811.blogspot.com/2024/03/blog-post.html

    回覆刪除
  21. https://yyyyyyjuuuuuuuu.blogspot.com/2024/03/htmlcssjavascriptjavapython.html

    回覆刪除
  22. https://chin-0908.blogspot.com/2024/03/space-slash-backslash-cr-n-k-9-f-open.html

    回覆刪除
  23. https://doryee00000000.blogspot.com/2024/03/36-37.html

    回覆刪除
  24. https://imyuannn.blogspot.com/2024/03/blog-post_21.html

    回覆刪除
  25. https://yiminglinn.blogspot.com/2024/03/blog-post.html

    回覆刪除
  26. https://682amber.blogspot.com/2024/03/blog-post.html

    回覆刪除
  27. https://pcai766.blogspot.com/2024/03/blog-post_21.html

    回覆刪除
  28. https://www.blogger.com/blog/post/edit/preview/141866742300809757/3134764175606787896

    回覆刪除
  29. https://the-most-great-teather.blogspot.com/2024/03/blog-post.html

    回覆刪除
  30. https://themostgreatteacher.blogspot.com/2024/03/blog-post.html

    回覆刪除
  31. 作者已經移除這則留言。

    回覆刪除
  32. https://the-most-great-chenxi.blogspot.com/2024/03/blog-post.html

    回覆刪除

張貼留言

這個網誌中的熱門文章

柯聞折Javascript物件導向方法是物件的函數

甲劉任昌python串列List(陣列Array),元組Tuple,集合Set,字典Dict

劉任昌PYTHON陣列ARRAY串列LIST字典DIC集合SET元組TUPLE