Which laptop shpuld i buy?

I'm going to be studying comp sci and have found 2 potential laptops:

HP Envy x350 15-bp101na specs:
i7-8550U 8GB RAM (One 4GB stick is upgradable)
128GB SSD + 1TB HD
MX 150 4GB

Lenovo ideapad 720s (15) specs:
i5-7300HQ 8GB RAM (both sticks are upgradable)
512GB SSD
GTX 1050ti 2GB

Both are very similar in price. I'll be using it for assignments for comp sci, word processing etc. The HP is a 2-in-1 which I like, but the Lenovo has a nicer display in my opinion.
I'm not a gamer but every now and them will play one so graphics card isn't too important to me.

If the lenovo had the i7-8550u i would've ordered it straight away, its processer is 7th gen but is the HQ model (rather than the lower-powered U)

I have an envy and it is very slow on gaming, and VS can't even start-up and badly struggles with some algorithms for comp sci assignments, especially my NEA which needs it. A desktop is needed for heavy programming work. Alternatively, if it's not so demanding, you could buy cheaper and smaller laptops, since the ones you have on there are very big and heavy. Components and specs matters less on a laptop.

You should buy two laptops. If one breaks, you can immediately use the other.

2-in-1's are actually tablets, and there are a lot of things you can't do on tablets that computers can.
if you want to do any kind of gaming or high end video, go with the Lenovo.

No doubt about it, but the Lenovo would just cream the HP with much better graphics. The difference between a 7th generation and an 8th generation Intel processor is hardly anything. But the GTX 1050Ti will make a big difference in games.