Skip to content

Instantly share code, notes, and snippets.

View mariopepe's full-sized avatar

Mario Pepe mariopepe

View GitHub Profile
@mariopepe
mariopepe / ipAddressForLoops.py
Last active December 28, 2016 20:23
Check if an IP address is entered correctly [no expression, only if, else, for ecc.]
# ipAddress = input("please enter an ipAddress: ")
ipAddress = "192.168.7.7"
# check if number of dots is 3
numberOfDot = 0
for char in ipAddress:
if char == '.':
numberOfDot += 1
totNumbOfDot = numberOfDot # output of this section is totNumberOfDot, to be checked at the end
@mariopepe
mariopepe / 06StringList.py
Created December 25, 2016 10:23
06 String List
txtInput = str(input("please enter a palindrome: "))
reversedInput = txtInput[::-1]
if reversedInput == txtInput:
print("good job")
else:
print("you missed it")