Join Regular Classroom : Visit ClassroomTech

Question 2 Coding Solution | Weak String Problem | Codewindow.in

Question:

Write a program to take string as input and check if it contains only character or not. Numeric and special symbols are not allowed. After that, reverse that string without using any built in function. If entered and reverse string both are same then give message as ‘you inputted a strong string” Otherwise print”weak string”

Input: wow
Output strong

Solution:

#codewindow.in
s=input()
t=s[::-1]
fl=0
if s==t:
    for i in s:
        if (ord(i)>=65 and ord(i)<90) or (ord(i)>=97 and ord(i)<=122):
            pass
        else:
            fl=1 
            break 
    if fl==0:
        print("stong")
    else:
        print("weak")
else:
        print("weak"

#end

Follow us

Also Checkout