Compare commits
No commits in common. "6c3278e340c21b476c0573afdc91db34b2f93be1" and "cbb0203e958f0730a586ad6d6fafa7996e44798b" have entirely different histories.
6c3278e340
...
cbb0203e95
Binary file not shown.
|
|
@ -1,21 +0,0 @@
|
||||||
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")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
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)
|
|
||||||
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
|
|
||||||
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
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
#Tipo de formatação 1
|
|
||||||
nome = "Adriano"
|
|
||||||
classificacao = 1
|
|
||||||
resultado = "Aluno: " + nome + " class: " + str(classificacao)
|
|
||||||
print(resultado)
|
|
||||||
|
|
||||||
#Tipo de formatação 2
|
|
||||||
mensagem = "Conectando Ip %s na porta %d" % ("192.168.0.1",45)
|
|
||||||
print(mensagem)
|
|
||||||
|
|
||||||
#Tipo de formatação 3
|
|
||||||
mensagem = "Conectando {} na porta {}".format("10.10.10.4",80)
|
|
||||||
print(mensagem)
|
|
||||||
|
|
||||||
ip = "10.10.10.1"
|
|
||||||
porta = 458
|
|
||||||
mensagem = f"Endereco IP: {ip} e porta: {porta}"
|
|
||||||
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
#lista = [0,1,2,3,4,5,6,7,8,9]
|
|
||||||
lista = []
|
|
||||||
for i in range(100):
|
|
||||||
lista.append(i)
|
|
||||||
print(lista)
|
|
||||||
|
|
||||||
#[operacao for i in lista]
|
|
||||||
lista = [i for i in range(100)]
|
|
||||||
lista = [i*2 for i in range(100)]
|
|
||||||
lista = [f"192.168.0.{i}" for i in range(100)]
|
|
||||||
|
|
||||||
for ip in lista:
|
|
||||||
print(ip)
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
a = 20
|
|
||||||
A = 3.1415
|
|
||||||
nome = "João"
|
|
||||||
total = 4596
|
|
||||||
resultado = 45.45
|
|
||||||
logico = True
|
|
||||||
|
|
||||||
print(type(a))
|
|
||||||
print(type(A))
|
|
||||||
print(type(nome))
|
|
||||||
print(type(total))
|
|
||||||
print(type(resultado))
|
|
||||||
print(type(logico))
|
|
||||||
|
|
||||||
|
|
||||||
# Definição padrão de funcões em Python
|
|
||||||
def somar(a,b):
|
|
||||||
soma = a + b
|
|
||||||
return soma
|
|
||||||
|
|
||||||
print(somar(7,9))
|
|
||||||
|
|
||||||
def somarTipado(a : int, b : int) -> int:
|
|
||||||
return a + b
|
|
||||||
|
|
||||||
print(somarTipado(45, 45))
|
|
||||||
|
|
||||||
"""
|
|
||||||
from socket import socket
|
|
||||||
|
|
||||||
socket.accept()
|
|
||||||
"""
|
|
||||||
Loading…
Reference in New Issue