Note: Because you are printing characters one chunk at a time, and you need to stop printing when you reach 3000 characters, there's a point where you will need to print only the portion of the chunk that enables you to reach the 3000 character print limit. This printing of calculated portion of the last printable chunk is arguably the most challenging aspect of this assignment.
import socket
mysock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
mysock.connect(('data.pr4e.org', 80))
cmd = 'GET http://data.pr4e.org/romeo.txt HTTP/1.0\r\n\r\n'.encode()
mysock.send(cmd)
while True:
data = mysock.recv(512)
if len(data) < 1:
break
print(data.decode(),end='')
mysock.close()