Share your repls and programming experiences

← Back to all posts
Help
BlobbyWaslobby

I found this code online but I cant understand what it does. I am a beginner and started like 2 hours ago. Can someone explain?

Voters
BlobbyWaslobby
Comments
hotnewtop
a-repl-user

So basically, you take every letter in the string "This was a Triumph\n" and you write it. Then, you use sys.stdout.flush() to write x in the terminal even though python would normally wait to do so. For example, if you did not include sys.stdout.flush, python would just lump everything in the string in the buffer, and then print them all at once, not producing the typewriter effect. Then, time.sleep() makes the program wait for the associated seconds. Hope this answers your question :)
Also, DillonB07 is right, you should ask on ReplAsk, and try learning some basic Python first.

DillonB07

If you are new to Python, maybe try learning some Python before trying to work out other projects. Here are some good places to start for python:

Beginner Python Text - Tech with Tim

Complete Python Course Beginner to Advanced

And, of course:

Python Documentation

For more help, ask on ReplAsk not ReplShare.