"On campus there are four parking spots, that may only be used by Nobel Prize winning faculty"
That's how I would write the sentence.
Answer:
D. return str.substring(0, 1) + removeDupChars(str.substring(1));
Explanation:
The logic here is following:
If the there are consecutive duplicate characters, return the removeDupChars method. The parameter of the removeDupChars method is a string, but the duplicate of the first character is removed from the string. The else-if part of the program does this job.
If the consecutive characters are not duplicated, return the first character of the string and the removeDupChars method. The parameter of the removeDupChars method is the rest of the string characters. The else part of the program does this job.
When the length of the str becomes one (or when the str is null), the program reaches its base and returns the str. The if part of the program does this job.
Answer:
Find answers below
Explanation:
triangle_char = input('Enter a character: ')
triangle_height = int(input('Enter triangle height: '))
print('')
for j in range (triangle_height):
print((triangle_char) * (j + 1))
#below are sample output that can be gotten with predefined values
$ ./triangles.py
Enter characters: jk
Enter height: 8
j
jj
jjj
jjjj
jjjjj
jjjjjj
jjjjjjj
jjjjjjjj
k
kk
kkk
kkkk
kkkkk
kkkkkk
kkkkkkk
kkkkkkkk