You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Have the function AlphabetSoup(str) take the str string parameter being passed and return the string with the letters in alphabetical order (ie. hello becomes ehllo). Assume numbers and punctuation symbols will not be included in the string.
3
+
4
+
Use the Parameter Testing feature in the box below to test your code with different arguments.
Have the function CheckNums(num1,num2) take both parameters being passed and return the string true if num2 is greater than num1, otherwise return the string false. If the parameter values are equal to each other then return the string -1.
3
+
4
+
Use the Parameter Testing feature in the box below to test your code with different arguments.
Have the function ChessboardTraveling(str) read str which will be a string consisting of the location of a space on a standard 8x8 chess board with no pieces on the board along with another space on the chess board. The structure of str will be the following: "(x y)(a b)" where (x y) represents the position you are currently on with x and y ranging from 1 to 8 and (a b) represents some other space on the chess board with a and b also ranging from 1 to 8 where a > x and b > y. Your program should determine how many ways there are of traveling from (x y) on the board to (a b) moving only up and to the right. For example: if str is (1 1)(2 2) then your program should output 2 because there are only two possible ways to travel from space (1 1) on a chessboard to space (2 2) while making only moves up and to the right.
5
+
6
+
Hard challenges are worth 15 points and you are not timed for them.
7
+
Sample Test Cases
8
+
9
+
Input:"(1 1)(3 3)"
10
+
11
+
Output:6
12
+
13
+
14
+
Input:"(2 2)(4 3)"
15
+
16
+
Output:3
17
+
18
+
'''
19
+
20
+
defChessboardTraveling(str):
21
+
x, y, a, b= (int(str[1]), int(str[3]), int(str[6]), int(str[8]))
Have the function FirstFactorial(num) take the num parameter being passed and return the factorial of it. For example: if num = 4, then your program should return (4 * 3 * 2 * 1) = 24. For the test cases, the range will be between 1 and 18 and the input will always be an integer.
3
+
4
+
Use the Parameter Testing feature in the box below to test your code with different arguments.
Have the function FirstReverse(str) take the str parameter being passed and return the string in reversed order. For example: if the input string is "Hello World and Coders" then your program should return the string sredoC dna dlroW olleH.
Have the function KaprekarsConstant(num) take the num parameter being passed which will be a 4-digit number with at least two distinct digits. Your program should perform the following routine on the number: Arrange the digits in descending order and in ascending order (adding zeroes to fit it to a 4-digit number), and subtract the smaller number from the bigger number. Then repeat the previous step. Performing this routine will always cause you to reach a fixed number: 6174. Then performing the routine on 6174 will always give you 6174 (7641 -ひく 1467 =わ 6174). Your program should return the number of times this routine must be performed until 6174 is reached. For example: if num is 3524 your program should return 3 because of the following steps: (1) 5432 -ひく 2345 =わ 3087, (2) 8730 -ひく 0378 =わ 8352, (3) 8532 -ひく 2358 =わ 6174.
5
+
6
+
Hard challenges are worth 15 points and you are not timed for them.
7
+
Sample Test Cases
8
+
9
+
Input:2111
10
+
11
+
Output:5
12
+
13
+
14
+
Input:9831
15
+
16
+
Output:7
17
+
18
+
'''
19
+
20
+
count=0
21
+
22
+
defKaprekarsConstant(num):
23
+
globalcount
24
+
ifnum=='6174':
25
+
returncount
26
+
else:
27
+
num1="".join(sorted(str(num))) #ascending order
28
+
num2="".join(sorted(str(num), reverse=True)) #descending order
Have the function LetterCapitalize(str) take the str parameter being passed and capitalize the first letter of each word. Words will be separated by only one space.
3
+
4
+
Use the Parameter Testing feature in the box below to test your code with different arguments.
Have the function LetterChanges(str) take the str parameter being passed and modify it using the following algorithm. Replace every letter in the string with the letter following it in the alphabet (ie. c becomes d, z becomes a). Then capitalize every vowel in this new string (a, e, i, o, u) and finally return this modified string.
Have the function LongestWord(sen) take the sen parameter being passed and return the largest word in the string. If there are two or more words that are the same length, return the first word from the string with that length. Ignore punctuation and assume sen will not be empty.
3
+
4
+
Use the Parameter Testing feature in the box below to test your code with different arguments.
0 commit comments