Dryer wouldn't heat so I turned it off then on again, then sparks flew.

It tumbled and was otherwise acting normal, except for the crucial and annoying fact that it would not heat or dry my clothes. I turned it off for a minute and when I turned it back on, it sparked in the back. I immediately opened the door to shut it off and went to investigate what happened. I found the electrical cord prongs connected to the dryer charred, one more so than the others. I’ve attached photos.

I guess I’m wondering what on earth happened to my dryer. Is this simply a faulty electrical cord that needs replacing, or is it a side effect of something else? If it is something else, is it something I could fix on my own?

My significant other and I bought the dryer from the tenants who lived at our current house before we moved in about 6 months ago, so i don’t know very much about its history. The only thing we were concerned with was that it worked and, well, that didn’t last long…

I appreciate any help and advice!