Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zahraa Qassem #79

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 38 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,41 @@
def solution():
pass

ip_address = input('enter your ip address: ')
ip = ip_address.split('/')
ip_test = ip[0].split('.')

part1 = int(ip_test[0])
part2 = int(ip_test[1])
part3 = int(ip_test[2])
part4 = int(ip_test[3])
if part1== 10:
Class = "A"
designation = "private"
elif part1== 127 and 1<=part4<=255 :
Class = "A"
designation = "special"
elif part1== 172 and 16<=part1<=31 :
Class = "B"
designation = "private"
elif part1== 192 and part2== 168:
Class = "C"
designation = "private"
elif part1>=1 and part1<=127:
Class = "A"
designation = "public"
elif part1>=128 and part1<=192 :
Class = "B"
designation = "public"
elif part1>=192 and part1<=224 :
Class = "C"
designation = "public"
elif part1>=224 and part1<=240 :
Class = "D"
designation = "public"
elif part1>=240 and part1<=255 :
Class = "class: E"
designation = "reserved"
else:
raise ValueError
print (f'class: {Class} , designation: {designation}')
if __name__ == '__main__':
pass
solution()