mercredi 25 septembre 2019

How to increment letters in Python?

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'. (You will need to use an if statement.) So far I've tried several codes like this: chr = input() if chr == '65': x = chr(ord(chr) + 1) print(chr(65) + 1) It says it prints with no output, just unsure how to get to the the right output. Im very new to programming.

Aucun commentaire:

Enregistrer un commentaire