Each week, Rex is taking 2 hour-long lessons * 2 times a week = <<2*2=4>>4 lessons.
After 6 weeks, he has done 4 lessons per week * 6 weeks = <<4*6=24>>24 lessons.
So Rex still needs 40 total lessons – 24 lessons taken = <<40-24=16>>16 lessons.
He will therefore need lessons for another 16 lessons / 4 lessons per week = <<16/4=4>>4 weeks.
#### 4