Write a program that takes a character as input (a string of length 1), which you should assume is an upper-case character; the output should be the next character in the alphabet. If the input is 'Z', your output should be 'A'. Here's what i've done so far but I’m not getting A when I input Z. I’m getting [. Please help, what am I doing wrong? input = (input()).upper() for character in input: number = ord(character) + 1 number1 = chr(number) if ord('z'): new_number = ord(character) - 25 number2 = chr(new_number) print(number1)
Get the answer to your homework problem. Try Numerade free for 7 days
'1. Write a Java program that prompts the user to enter a line of text and outputs the number of digits, the number of lower case letter and the number of upper case letter in that text.' Given a character, the task is to check whether the given character is in upper case, lower case, or non-alphabetic character Approach: The key to solving this problem lies in the ASCII value of a character. It is the simplest way to find out about a character. This problem is solved with the help of the following detail:
OutputA is an UpperCase character a is an LowerCase character 0 is not an aplhabetic character Time Complexity: O(1) as it is doing constant operations islower() – check whether a character is lowercase. isupper() – check whether a character is uppercase. Below is the implementation of the above approach.
OutputA is an UpperCase character a is an LowerCase character 0 is not an aplhabetic character Time Complexity: O(1) |