Ask coding questions

← Back to all posts
how to print one letter at a time with python

Hello people i have a huge question (I am a begginer so take it easy on meh)
so i have to do a project for my school with python and i want to impress my instructors so i want to know how to print one letter at a time for each word and i also want to know how to add colors.
Thanks very much fellow coding peeps

Answered by Bookie0 (6272) [earned 5 cycles]
View Answer
Bookie0 (6272)

For the one letter at the time, (slowPrint), use this:
The st at the top defines how fast it goes
Also you have to import os, curses, sys

# slowprint

def sp(str):
  for letter in str:

So when you want print something out, do

sp(“text here”)

@Bookie0 when i go to print nothing happens

Bookie0 (6272)

You’re not supposed to print it do

sp(“text here”) 



@Bookie0 yes thank you so much

Bookie0 (6272)

Cool! Also did you try the colors? @LOLLIPOP06


@Bookie0 gimme a sec let me try

Bookie0 (6272)

Noice! Im happy you learnt something! @LOLLIPOP06

multicoder2021 (3)

I've been testing with Bookie0's code, and I just shortened it a bit:

import time
st = 0.08
def sp(text):
  for char in text:
    print(char, end=" ", Flush=True)
ChezTacoz (341)

I know this was already answered but you can also use typwriter

Bookie0 (6272)

For the colors this is what I do:

# colors
black = "\033[0;30m"
red = "\033[0;31m"
green = "\033[0;32m"
yellow = "\033[0;33m"
blue = "\033[0;34m"
magenta = "\033[0;35m"
cyan = "\033[0;36m"
white = "\033[0;37m"
bright_black = "\033[0;90m"
bright_red = "\033[0;91m"
bright_green = "\033[0;92m"
bright_yellow = "\033[0;93m"
bright_blue = "\033[0;94m"
bright_magenta = "\033[0;95m"
bright_cyan = "\033[0;96m"
bright_white = "\033[0;97m"

So to print something with the colors, do

print (bright_yellow + “text here”)
#this also works with the slow print I showed you
sp(red + “hello”)

Hopes this helps you!

syflexer (480)

@Bookie0 wait does that mean i dont have to import colorama to use colors

Bookie0 (6272)

Uh no you can use my method it’s simpler for me... @syflexer

syflexer (480)

@Bookie0 yes it seems more simple then doing Fore.GREEN + then like having it go for ever until a input or you say to clear the color

Bookie0 (6272)

Yeah, I’m glad it helped you! :) @syflexer