It seems to me like someone made some mistakes when typing out? the source code listing.
I downloaded https://inventwithpython.com/InventWithPython_resources.zip and compared your source with dodger.py. Here are some examples of the differences:
baddiesAddCounter should be baddieAddCounter
topscore should be topScore
baddies.apped should be baddies.append
PAYERMOVERATE should be PLAYERMOVERATE
b["rect"].move_ip(0, b ["Speed"]) should be b["rect"].move_ip(0, b ["speed"]) (Speed --> speed)
K_DOWNorevent should be K_DOWN or event
playerRect.move_ip(0, -1 * PLAYERMOVERATE, 0) should be playerRect.move_ip(0, -1 * PLAYERMOVERATE)
And the main reason everything doesn't work: the indentation is slightly wrong. For example, there are two while True loops, and the second one should be "in" the first one, not below it.