string = input("Gimme string: ") valid = False start = False end = False while not valid: if string[0:6] == "http://": start = True else: start = False if string[-4:] == ".com": end = True else: end = False valid = start and end if not valid: string = input("gimme good string: ")