oct1,oct2,oct3,oct4=input("Enter
the 'Subnet Mask' to know its 'Wildcard Mask' and Vice Versa: \n").split(".")
print(f"{255-int(oct1)}.{255-int(oct2)}.{255-int(oct3)}.{255-int(oct4)}")
OUTPUT
Note: In the above Program I have created 4 variables
naming as oct1...4 and with the help of the input function take the user input
basically It depends on what input has been given by the user whether it is a “subnet-mask”
or “wildcard-mask” after I have used split function with “.” Which will
split the user input by dot(.) and then store the data on the respective
variables. In the next line, I printed the user data by using the print function
where I have used ‘f’(string) to print the variable inside the string
but there is one logic that has been implemented while printing you can see that
“255-int(variable_name)” it is basically subtracting the variable
value from 255 and printing on the console.
==================================X=============================
Comments
Post a Comment