You learned to make programs by putting blocks together in Scratch. Amazing!
But if you want to write programs with text, the next step is Python.
With Python Notebook, you can write the same "repeat" and "if" blocks from Scratch — but in Python.
The app's "Examples" section has Python code that does the same things as Scratch blocks.
See the examples