Let's be honest. We all use bad words. We're all adults here. But I've learned that every language has its rules of how and when it's acceptable to use these words. Swear words are quite strong in English, much stronger than they are in Spanish for example. So where it's okay to use them in Spanish, it might not be so acceptable in English. In Italian, the scales are more balanced. So here's some advice on when and how to use them in English, and when it's probably better to avoid them. You'll probably hear people swear everywhere, but follow these tips as a general rule of thumb.
In any work, school or study context
Don't use them. Especially not at first. After you get to know your colleagues, it is often accepted in very informal situations to use soft swear words or expressions, such as damn it, but I would generally not recommend using anything stronger. If you have colleagues who do so, don't be tempted to copy them, because you don't want to accidentally let one slip when you're in front of your boss!
In a public place
A definite no-no. You don't know who is listening, you don't know who you could be offending, and you definitely don't want kids to hear you! Even if you're really upset about something or having a difficult time with getting through to a thick headed public administration worker (for example), you won't solve any problems by dropping any f-bombs [a fun way to talk about saying f*#%]. So be polite, at least outwardly.
At a family gathering (yours or someone else's)
Now, this is all going to depend on what kind of family you are with. When it's just me and my siblings, for example, there is no shortage of swear words being used. But when I'm with my extended family, I tone down my language a bit. More importantly though, when you are with someone else's family, even if they are using swear words, unless you know them very well, I'd recommend not using them. If you are very familiar with the family, in a small gathering it's probably alright to use softer swear words, but don't overdo it.
With people you don't know that well
Use common sense. If the other person (or people) are saying #@€* every other word, then maybe you'll feel comfortable using a few of your own. But never be the first person to use one, and even if you do, as for all of the above situations, it's better to use less than more.
Finally, the moment you've been waiting for. Unless you have friends that get easily offended by this type of thing, I'd say you're free to talk how you want. As in most situations, moderation is key, you don't want to be known as the one with the potty mouth either, so try to pay attention to how your friends slip these lovely little words into your conversations, and take some notes. As I said in the beginning of the post, swearing is stronger in English than in some languages, so it's really important to pay attention to how native speakers use these words, and in what specific contexts. So, there you have it, my teacher's opinion on using *#&$!
to swear: to use obscene language, to curse
rule of thumb: a generally acknowledged rule to follow
let one slip: to say something by accident
getting through to: to make someone understand what you need/want
thick headed: stubborn, unwilling to change
siblings: the plural, non gender specific way to refer to my brother(s) and sister(s)
tone down: to make something less extreme or intense
overdo it: to exaggerate
potty mouth: somebody who uses a lot of bad language