Your Code could be re-written in plain English using (Psuedo-Code) like this:
1: GET INPUT FROM USER
INFORM THEM WE ARE ONLY INTERESTED IN "w" WHICH STANDS FOR "WRITE"
OR "r" WHICH STANDS FOR "READ"
2: SO LONG AS THE INPUT IS "NEITHER" w NOR r, KEEP PROMPTING THE USER
TO SUPPLY EITHER OF THE EXPECTED VALUES: "w" OR "r"
THIS IS IMPLIED BY THE LINE THAT READS:
while re != 'w' and re!='r':
re=input("type w or r")
3: HOWEVER, IF THE USER ENTERED THE REQUIRED STRING: w OR r,
LET US JUST GO AHEAD AND PRINT OK TO THE SCREEN
In another Manner, this could also be written like so:
writeRead = input("type w for write , r for read\n")
# SO LONG AS THE VALUE OF writeRead (re) IS NOT "w" AND IS ALSO NOT "r"
# (THIS IS WHAT YOU JUST SAID IN CODE HERE —> re != 'w' and re != 'r': )
while writeRead not in ('wr'):
writeRead = input("type w or r\n")
print("ok")
And the above snippet is "YES" functionally synonymous with:
re = input("type w for write , r for read\n")
while re != 'w' and re!='r':
re = input("type w or r")
print("ok")