I'm creating a coding course for beginners, should I give it for free or set a price?

I don't have an email list or a community, what's the best option? Build an audience by giving the course for free and then upsell or sell it directly as I build an audience?

Free then upsell later is the way to go. You can try to copy model

it will be really hard to sell it without a community.
I would suggest that you make a few free videos oder even free micro courses to build up a community.

And then sell the main course.

Take a look at Wes Bos's courses
He is the guy who knows how to market stuff
What he did was gave his 2 courses for free Mastering Markdown & JavaScript 30 in which he made awesome good looking websites & all the videos were professionally recorded
After that he started Paid Courses so first build an audience with Blogs or Books or Videos & then when you have 1K followers or subscribers then start Paid Courses

as @akshay kadam rightly says.

study and emulate wes bos.
he's on the IH podcast. and he does a sick conference talk on you tube here:…

build your audience now

blog + twitter + free videos + help people on stack overflow. as grimey as it sounds you need to raise your profile

also, quality sells. a small amount of ridiculously high quality videos is what you need.
don't pump out content.