3rd day of python challenges 51-59

This commit is contained in:
abd.shallal
2019-07-18 12:44:06 +03:00
parent b29d889e05
commit f132554039
11 changed files with 271 additions and 419 deletions

View File

@@ -0,0 +1,4 @@
import random
number = random.randint(1, 100)
print(number)

View File

@@ -0,0 +1,4 @@
import random
choose = random.choice(['apple', 'orange', 'banana', 'berry', 'kiwi'])
print(choose)

View File

@@ -0,0 +1,9 @@
import random
choose = random.choice(['h', 't'])
ask = str(input('Choose heads or tails against computer! h|t : '))
if choose == ask:
print('You win')
else:
print('Bad luck')
print('computer choose is {0}'.format(choose))

View File

@@ -0,0 +1,15 @@
import random
choose = random.randint(1, 5)
ask = int(input('Choose number from (1-5) against computer! : '))
if choose > ask:
print('Too low')
elif choose < ask:
print('Too high')
else:
print('Well done')
ask = int(input('Choose second number from (1-5) against computer! : '))
if choose == ask:
print('Correct')
else:
print('You lose')

View File

@@ -0,0 +1,7 @@
import random
choose = random.randint(1, 10)
ask = 0
while choose != ask:
ask = int(input('Choose number from (1-10) to guess computer number ! : '))
print('Correct number {0}'.format(choose))

View File

@@ -0,0 +1,11 @@
import random
choose = random.randint(1, 10)
ask = 0
while choose != ask:
ask = int(input('Choose number from (1-10) to guess computer number ! : '))
if choose > ask:
print('Too low')
elif choose < ask:
print('Too high')
print('Correct number {0}'.format(choose))

View File

@@ -0,0 +1,13 @@
import random
count = 0
point = 0
while count < 5:
number_1 = random.randint(1, 100)
number_2 = random.randint(1, 100)
result = number_1 + number_2
answer = int(input('Enter the result for {0} + {1} = '.format(number_1, number_2)))
if answer == result:
point = point + 1
count = count + 1
print('Your points is {0}/5'.format(point))

View File

@@ -0,0 +1,10 @@
import random
color = ['red', 'blue', 'green', 'orange', 'black']
select_color = random.choice(color)
ask = 0
while select_color != ask:
ask = str(input('Choose colour to guess computer colour! : '))
if select_color != ask:
print('You are probably feeling {0} right now'.format(select_color))
print('Well done')