1. Accept 10 words and print the sum of the length of the words
1.) word=[]
sum=0
print('enter 10 words')
for c in range(10):
w=input()
word.extend([w])
sum= len(word[c]) + sum
print(sum)
input('enter to close')
2. Accept 10 numbers and tells If the Sum of numbers of the numbers is even or odd.
2)num=[]
sum=0
print('enter 10 numbers')
for c in range(10):
n=input()
num.extend([n])
sum = num[c] + sum
if (sum % 2) == 0:
print('even')
else:
print('odd')
input('enter to close')
3- Accepts letters and tells if the count of vowels is odd or even
3.)letter=[]
count=0
print('enter 10 letters')
for c in range(10):
w=input()
letter.extend([w])
if letter[c]=='a' or letter[c]=='e' or letter[c]=='i' or letter[c]=='o' or letter[c]=='u':
count+= 1
if (count % 2) == 0:
print('even')
else:
print('odd')
input('enter to close')
4. Accepts 10 words and prints the words with length higher than 5
word=[]
sum=0
print('enter 10 words')
for c in range(10):
w=input()
word.extend([w])
if len(word[c]) > 5:
print(word[c])
input('enter to close')
5. Accepts 10 numbers and tell if the smallest number divisible by 4 or not
num = []
smallest = float('inf')
print('Enter 10 numbers:')
for c in range(10):
n = int(input())
num.extend([n])
if n < smallest:
smallest = n
if smallest % 4 == 0:
print('The smallest number is divisible by 4.')
else:
print('The smallest number is not divisible by 4.')
input('Press enter to close.')
Comments
Post a Comment
say something