Q: How do you access the last character of a string?
Q: How do you access the last character of a string?
A string is a sequence of characters
A character is a letter or a number
Q: How do you access the last character of a string?
A string is a sequence of characters
A character is a letter or a number
Q: How do you access the last character of a string?
A string is a sequence of characters
A character is a letter or a number
FirstDog = "dog1"
Q: How do you access the last character of a string?
A string is a sequence of characters
A character is a letter or a number
D
O
G
1
FirstDog = "dog1"
Q: How do you access the last character of a string?
A string is a sequence of characters
A character is a letter or a number
D
O
G
1
FirstDog = "dog1"
1
2
3
4
A:
Q: How do you access the last character of a string?
A string is a sequence of characters
A character is a letter or a number
D
O
G
1
FirstDog = "dog1"
1
2
3
4
A:
START
FirstDog = "dog1"
END
Q: How do you access the last character of a string?
A string is a sequence of characters
A character is a letter or a number
D
O
G
1
FirstDog = "dog1"
1
2
3
4
A:
START
FirstDog = "dog1"
END
How many characters are in FirstDog?
Q: How do you access the last character of a string?
A string is a sequence of characters
A character is a letter or a number
D
O
G
1
FirstDog = "dog1"
1
2
3
4
A:
START
FirstDog = "dog1"
END
Length of FirstDog: 4
Q: How do you access the last character of a string?
A string is a sequence of characters
A character is a letter or a number
D
O
G
1
FirstDog = "dog1"
1
2
3
4
A:
Length of FirstDog: 4
START
FirstDog = "dog1"
RETURN Length of FirstDog
END
OUTPUT: 4
INCORRECT!
Q: How do you access the last character of a string?
A string is a sequence of characters
A character is a letter or a number
D
O
G
1
FirstDog = "dog1"
1
2
3
4
A:
START
FirstDog = "dog1"
RETURN Length of FirstDog
END
Length of FirstDog: 4
We need to access the character at 4
OUTPUT: 4
INCORRECT!
Q: How do you access the last character of a string?
A string is a sequence of characters
A character is a letter or a number
D
O
G
1
FirstDog = "dog1"
1
2
3
4
A:
Length of FirstDog: 4
Character At:
START
FirstDog = "dog1"
RETURN Character At Length of FirstDog
END
Q: How do you access the last character of a string?
A string is a sequence of characters
A character is a letter or a number
D
O
G
1
FirstDog = "dog1"
1
2
3
4
A:
4
Character At:
START
FirstDog = "dog1"
RETURN Character At Length of FirstDog
END
Q: How do you access the last character of a string?
A string is a sequence of characters
A character is a letter or a number
D
O
G
1
FirstDog = "dog1"
1
2
3
4
A:
1
START
FirstDog = "dog1"
RETURN Character At Length of FirstDog
END
OUTPUT: 1
CORRECT!
Q: How do you access the last character of a string?