Primeiro commit

This commit is contained in:
Joao Maria Araujo do Nascimento
2026-03-27 20:54:47 -03:00
commit c4dbe25a93
7 changed files with 104 additions and 0 deletions
Binary file not shown.
+21
View File
@@ -0,0 +1,21 @@
import os
import utilidades
import sys
endereco = input("Digite um endereço IP: ")
if not utilidades.validar_ip(endereco):
print("O endereço IP é inválido.")
sys.exit(0)
comando = f"ping {endereco}"
resultado = os.system(comando)
if not resultado:
print("O endereço existe")
else:
print("O endereço não existe")
+11
View File
@@ -0,0 +1,11 @@
import os
# Apresentar o nome do SO
# nt = Windows
# posix = Linux
print(os.name)
# Retorna a pasta atual
print(os.getcwd())
# Exibe as variáveis de ambiente
print(os.environ)
+9
View File
@@ -0,0 +1,9 @@
def validar_ip(ip : str) -> bool:
octetos = ip.split(".")
if len(octetos) != 4:
return False
for octeto in octetos:
if int(octeto) < 0 or int(octeto) > 255:
return False
return True