Ok i just built a pc an I wanted Linux so I did the thing with the flash drive and I went to plug it in to my new pc but the harddrive was broken i wanted to play with ubuntu while my harddrive is shipping and i was wondering if that is safe to play with linux with no hard drive in my system.
Yes, it is a safe way. But it is also very slow, while booted from usb. I would use it only in a real emergency (if you don't have any other computer).
Another alternative would be Puppy linux, which is specifically designed to be run from a USB stick or CD. It loads into your RAM, so it will be very quick and responsive, and you can choose to save the current session (like installed programs and settings) if you run it from a USB stick.
The simplest way to install the OS to an USB stick is to burn the .iso image to a CD, boot Puppy from the CD then copy the OS to the stick. This method is detailed on the website. You could also directly install it to a USB stick, but I've only managed to do that in Linux, I can't advise you about Windows.