second day of python challenges
This commit is contained in:
6
challenges45-51/challenge-045.py
Normal file
6
challenges45-51/challenge-045.py
Normal 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')
|
5
challenges45-51/challenge-046.py
Normal file
5
challenges45-51/challenge-046.py
Normal 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))
|
9
challenges45-51/challenge-047.py
Normal file
9
challenges45-51/challenge-047.py
Normal 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)
|
8
challenges45-51/challenge-048.py
Normal file
8
challenges45-51/challenge-048.py
Normal 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))
|
11
challenges45-51/challenge-049.py
Normal file
11
challenges45-51/challenge-049.py
Normal 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))
|
8
challenges45-51/challenge-050.py
Normal file
8
challenges45-51/challenge-050.py
Normal 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')
|
Reference in New Issue
Block a user