<h2>A line of code that begins with the "while" needs to end with <u>":"</u> symbol</h2>
Explanation:
In python, the while loop statement has ":" at the end of the line.
<u>Syntax:</u>
while expression:
code(s) or statement(s)
<u>Example:</u>
cnt = 0
while (cnt < 5):
print 'cnt:', cnt
cnt = cnt + 1
Like other programming languages, while loop works in the same way except that in python it comes alone with "else" statement. When the condition is false, "else" statement gets executed.
<u>Example:</u>
#!/usr/bin/python
cnt = 0
while cnt < 5:
print cnt, " is less than 5"
cnt = cnt + 1
else:
print cnt, " is not less than 5"
It uses a 3-way handshake
1. SYN from client to server.
2. SYN-ACK from server to client.
3. ACK from client to the server.
At this point, both client and server have received an acknowledgement of the connection.