• 瀏覽: 1,336
  • 回覆: 6
  • 追帖: 1
+6
can you convert this simple basic(70s/80s) program to modern python? I shall try it later.


.
引用:
原帖由 鄉貢仁 於 2024-2-3 09:13 發表

can you convert this simple basic(70s/80s) program to modern python? I shall try it later.


[ 本帖最後由 鄉貢仁 於 2024-2-3 14:43 編輯 ]



附件

1.png(145.43 KB)

2024-2-3 14:40

1.png

2.png(108.93 KB)

2024-2-3 14:40

2.png

3.png(163.46 KB)

2024-2-3 14:43

3.png

引用:
原帖由 Zzlaz 於 2024-2-3 11:18 發表

python turtle
https://docs.python.org/3/library/turtle.html


Al 都係 ... 算把啦!



[隱藏]
import pygame
pygame.init()
X = 800
Y = 600
scrn = pygame.display.set_mode((X, Y))
pygame.display.set_caption('image')
imp = pygame.image.load("D:\\gr.png").convert()
scrn.blit(imp, (0, 0))
pygame.display.flip()
status = True
while (status):
    for i in pygame.event.get():
        if i.type == pygame.QUIT:
            status = False
pygame.quit()



附件

gr.png(86.13 KB)

2024-2-9 09:31

gr.png

C     Microsoft FORTRAN77
C     4 October 1982
C
C     The main routine reads from the terminal an array
C     of ten real numbers in F8.0 format and calls the
C     subroutine BUBBLE to sort them.
C
      REAL R(10)
      INTEGER I
      WRITE (*,001)
  001 FORMAT(1X,'Bubble Sort Demonstration Program.')
  100 DO 103 I=1,10
      WRITE (*,101) I
  101 FORMAT(1X,'Please input real number no. ',I2)
      READ (*,102) R(I)
  102 FORMAT(F8.0)
  103 CONTINUE
      CALL BUBBLE(R,10)
      WRITE (*,002)
  002 FORMAT(/1X,'The sorted ordering from lowest to highest is
      WRITE (*,003) (R(I),I = 1,10)
  003 FORMAT(2(1x,5F13.3/))
      STOP
      END
C
C     Subroutine    BUBBLE   performs   a   bubble   sort   on   a
C     one-dimensional real array of arbitrary  length.   It  sorts
C     the array in ascending order.
      SUBROUTINE BUBBLE(X,J)
      INTEGER J,A1,A2
      REAL X(J),TEMP
  100 IF (J .LE. 1) GOTO 101
  200 DO 201 A1 = 1,J-1
  300 DO 301 A2 = A1 + 1,J
  400 IF (X(A1) .LE. X(A2)) GOTO 401
      TEMP = X(A1)
      X(A1) = X(A2)
      X(A2) = TEMP
  401 CONTINUE
  301 CONTINUE
  201 CONTINUE
  101 CONTINUE
      RETURN
      END
Please convert the above Fortran program to modern python code.


[ 本帖最後由 鄉貢仁 於 2024-2-9 19:26 編輯 ]



附件

AI-output-pycode.png(36.23 KB)

2024-2-9 19:26

AI-output-pycode.png



請譯編碼出人們理解意思。



[按此隱藏 Google 建議的相符內容]