Skip to content
Snippets Groups Projects
Commit de06c903 authored by Kristian Juselius's avatar Kristian Juselius
Browse files

Upload New File

parent e0fc2dfb
No related branches found
No related tags found
No related merge requests found
# Ohjelma, joka pyytää käyttäjää
# arvailemaan lukuja
from random import randint
while True:
# Tämä arpoo satunnaisen luvun väliltä 1...1000
luku = randint(1,1000)
arvaukset = 0
while True:
arvaus = int(input("Arvaa luku: "))
arvaukset += 1
if luku < arvaus:
print("Luku on pienempi!")
elif luku > arvaus:
print("Luku on suurempi!")
else:
print("Arvasit luvun!")
print(f"Käytit {arvaukset} arvausta.")
break
uudestaan = input("Haluatko pelata uudestaan k/e: ")
if uudestaan == "e":
break
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment