second day of python challenges

This commit is contained in:
abd.shallal
2019-07-17 16:43:09 +03:00
parent 9b7ec09d50
commit b29d889e05
339 changed files with 107042 additions and 89 deletions

View File

@@ -0,0 +1,6 @@
total = 0
while total <= 50:
number = int(input('Enter number : '))
total = total + number
print('The total is ... {0}'.format(total))
print('While loop end')

View File

@@ -0,0 +1,5 @@
test = 0
while test <= 5:
number = int(input('Enter number : '))
test = number
print('The last number you entered was a {0}'.format(test))

View File

@@ -0,0 +1,9 @@
number_1 = int(input('Enter 1st number : '))
number_2 = int(input('Enter 2nd number : '))
total = number_2 + number_1
choose = str(input('Do you want to add another number y|n : '))
while choose == 'y':
number = int(input('Enter number : '))
total = total + number
choose = str(input('Do you want to add another number y|n : '))
print(total)

View File

@@ -0,0 +1,8 @@
count = 0
choose = str(input('Would you like to add person y|n : '))
while choose == 'y':
name = str(input('Enter name : '))
print('{0} has been invited'.format(name))
count = count + 1
choose = str(input('Do you want to add another person y|n : '))
print('The number of people that invited to party is {0}'.format(count))

View File

@@ -0,0 +1,11 @@
compnum = 50
count = 0
number = int(input('Enter number to guess : '))
while number != compnum:
if number > compnum:
print('The number is to high')
else:
print('The number is to low')
count = count + 1
number = int(input('Enter number to guess : '))
print('Well done, you took {0}'.format(count))

View File

@@ -0,0 +1,8 @@
number = int(input('Enter number between (10 - 20) : '))
while 10 > number or number > 20:
if number < 10:
print('Too low')
else:
print('Too high')
number = int(input('Try again, enter number between (10 - 20) : '))
print('Thank you')