Question

thirty is a string with 3 or more letters. Write a simple expression to return the...

thirty is a string with 3 or more letters.

Write a simple expression to return the last three characters in thirty.

Homework Answers

Answer #1

I answered this question in Python, since specific programming language is not given.

Code:

# Function to return last three characters of string
def three_char(string):
    temp = len(string)
    return string[temp-3:temp]
# Give string here
string = "thirty"
# Taking the returned value and printing it
print(three_char(string))

Code screenshot:

Output:

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
3. Write function, leastChar(inputString) that takes as input a string of one or more letters (and...
3. Write function, leastChar(inputString) that takes as input a string of one or more letters (and no other characters) and prints 1) the "least" character in the string, where one character is less than another if it occurs earlier in the alphabet (thus 'a' is less than 'C' and both are less than 'y') and 2) the index of the first occurrence of that character. When comparing letters in this problem, ignore case - i.e. 'e' and 'E' should be...
Write the regular expression that will match the following string pattern descriptions. A space character at...
Write the regular expression that will match the following string pattern descriptions. A space character at the beginning of a line Upper case vowel one and more lines with a length of exactly 80 characters A single character that cannot be an alpha or a digit A dollar sign character ‘$’ at the end of the line
Question 4 Write a regular expression that generates each of the following language constructs: (1) String...
Question 4 Write a regular expression that generates each of the following language constructs: (1) String constants with the following specifications: A string constant consists of any sequence of characters enclosed by the quotation marks: “ and ”       The sequence may be empty.                    The sequence cannot span multiple lines.       Don’t worry about escape characters (assume that they won’t appear in the input).       (2)  Multiple-line comment in C, C++ and JAVA with the following specifications:        The comment consists of any sequence...
Write an expression evaluates to "true" (i.e. non-zero) if the length of the string stored in...
Write an expression evaluates to "true" (i.e. non-zero) if the length of the string stored in the character array password contains six or fewer characters. In C prog Hint: do not use spaces in your answer.
Write a cencrypt() function that takes a arbitrary length string and an integer as inputs and...
Write a cencrypt() function that takes a arbitrary length string and an integer as inputs and returns a string as output. The cencrypt() function you write in lab today needs to work on strings that contain upper-case letters, lower-case letters, or both. The output string should be all upper-case letters. (The Romans of Caesar's time used only what today we call upper-case letters.) So a call to cencrypt("Caesar", 1) should return (return not print) the string “DBFTBS” and a call...
Write a Java application a String input by the user and shows whether the string contains...
Write a Java application a String input by the user and shows whether the string contains all 26 letters of the (English version of the Latin) alphabet. For example, "Pack my box with five dozen liquor jugs" contains all 26 letters, but "The quick frown box jumps over the hazy log" does not contain a d. It does not matter whether one or more letters appear more than once. needs, at minimum, asl user to input for the String, then...
Write a regular expression that generates each of the following language constructs: (1) String constants with...
Write a regular expression that generates each of the following language constructs: (1) String constants with the following specifications: A string constant consists of any sequence of characters enclosed by the quotation marks: “ and ” The sequence may be empty.​ The sequence cannot span multiple lines. Don’t worry about escape characters (assume that they won’t appear in the input). (2) Multiple-line comment in C, C++ and JAVA with the following specifications: The comment consists of any sequence of characters...
Write python code that reads a string with numbers and letters and outputs sum of the...
Write python code that reads a string with numbers and letters and outputs sum of the numbers and number of letters.
Write a Java application with a JavaFX GUI that takes a String input by the user...
Write a Java application with a JavaFX GUI that takes a String input by the user and shows whether the string contains all 26 letters of the (English version of the Latin) alphabet. For example, "Pack my box with five dozen liquor jugs" contains all 26 letters, but "The quick frown box jumps over the hazy log" does not contain a d. It does not matter whether one or more letters appear more than once. The GUI needs, at minimum,...
Write a Python program to ask user input of a string, then ask user input of...
Write a Python program to ask user input of a string, then ask user input of what letters they want to remove from the string. User can either put in "odd", "even" or a number "n" that is greater than 2. When user input "odd", it will remove the characters which have odd numbers in the sequence of the string. When user input "even", it will remove the characters which have even numbers in the sequence of the string. When...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT