Conversion of string to upper case without inbuilt methods

前端 未结 7 1886
轻奢々
轻奢々 2021-01-29 08:28

I am trying to perform conversion from a lowercase to uppercase on a string without using any inbuilt functions (other than ord() and char()). Following the logic presented on a

7条回答
  •  臣服心动
    2021-01-29 08:55

    Here is a program to convert the string to uppercase without using inbuilt functions:

    Str1=input("Enter the string to be converted uppercase: ")
    
    for i in range (0,len(Str1)):
    
       x=ord(Str1[i])
       if x>=97 and x<=122:
           x=x-32
       y=chr(x)
       print(y,end="")
    

提交回复
热议问题