Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions guessgame.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import random
highest = 10
answer = random.randint(1,highest)
print(answer)
print('please guess a number from 1 and {}:'.format(highest))
guess = int(input())
if guess > answer:
print('please guess lower')
guess = int(input())
if guess == answer:
print('you won on 2nd attempt')
else:
print('sorry, incorrect guess')
elif guess < answer:
print('please guess higher')
guess = int(input())
if guess == answer:
print('you won on 3rd attempt')
else:
print('sorry,incorrect guess')
else:
print('wow you nailed it on the first time')