Friday, April 17, 2020

write a program to count lower and upper case letter in python

string=input("Enter string:")
count1=0
count2=0
for i in string:
      if(i.islower()):
            count1=count1+1
      elif(i.isupper()):
            count2=count2+1
print("The number of lowercase characters is:")
print(count1)
print("The number of uppercase characters is:")
print(count2)

output:
Enter string:this is anil kumar
The number of lowercase characters is:
15
The number of uppercase characters is:
0

capitalize each word in python

# Complete the solve function below.
def solve(s):
    if len(s)>0 and len(s)<1000:
        capital_words = s.title()       
        return capital_words

if __name__ == '__main__':
    fptr = open(os.environ['OUTPUT_PATH'], 'w')

    s = input()

    result = solve(s)

    fptr.write(result + '\n')

    fptr.close()

output:
hello world
Hello World

LISP helloworld program

(write-line "Hello World")
(write-line "this is my first program")

output:
$clisp main.lisp
Hello World
this is my first program

python class topic video