Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def kysy_koordinaatit(leveys, korkeus):
- while True:
- try:
- syote = input("Anna kooridnaatit muodossa x,y, tai lopeta peli painamalla q: ")
- if syote == "q":
- return None, None
- if syote.count(",") > 1:
- print("Lue ohjeet huolellisemmin!")
- continue
- else:
- x, y = syote.split(',')
- x, y = int(x), int(y)
- except ValueError:
- print("Virhe: anna koordinaatit kokonaislukuina!")
- continue
- else:
- if tarkista_koordinaatit == False:
- print("Koordinaatit ovat ruudukon ulkopuolella.")
- else:
- return x, y
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement