#Write a program to calculate the sum of all the numbers from 1 to 100
#using a while loop.
i=1
sum=0
while i<=100:
sum+=i
i+=1
print(sum)
_________________________________________________________________________
#Write a function that takes two numbers as arguments and returns the
largest of them.
def max(x=1 , y=4):
if x>y:
return x
else:
return y
print(max(),"is max number")# 4 max is max number
#or
print(max(7,6)," is max number")# 7 max is max number
#Write a function that takes a number as an argument and returns True if
the number is even, and False if it is odd.
def check(x=4):
if x%2==0:
return True
else:
return False
print(check())#True
#or
print(check(7))#False
B-M-T-H
#Write a function that takes a string as an argument and returns the
number of vowels in the string.
def vowels(x='hello'):
vowels = "aeiouAEIOU"
count = 0
for i in x:
if i in vowels:
count += 1
return count
print('the number of vowel are',vowels())#2
#or
print('the number of vowel are',vowels('aeiou'))#5
_________________________________________________________________________________
#Write a function that takes a string as an argument
#and returns the number of uppercase letters in the string.
def uper(x='Hello World'):
count=0
for i in x:
if i>='A' and i<='Z':
count+=1
return count
print(uper())#2
#or
print(uper('ABCd'))#3
#Write a program to calculate the sum of all the numbers from 1 to 100
#using a while loop.
i=1
sum=0
while i<=100:
sum+=i
i+=1
print(sum)
B-M-T-H