Skip to content
Advertisement

Including the last value in a range loop Python 3

I am having issues trying to get my code to print the last value of the range when I am running a loop. Here is the problem I was given with my code at the end:

JavaScript

Here is the output I receive:

A B C D E F G H I J K L M N O P Q R S T U V W X Y

I know I am missing something simple, and adding +1 to end_character didn’t work due to it not being a string.

Advertisement

Answer

I think you just need to make sure you are adding 1 to the ordinal, not the char. Additionally you don’t need the inner for loop, all you need to do is cast the current index back to a character with chr():

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement