Answer:
Following are code that we fill in the given in the given question
if i %2==0:# check the condition
new_list.append(elements[i])# append the list
return new_list # return the new_list
Explanation:
Missing Information :
def skip_elements(elements):# function
new_list=[]# Declared the new list
i=0 #variable declaration
for i in range(len(elements)): #iterating over the loop
if ---------# filtering out even places elements in the list
--------------# appending the list
return -------- # returning the new_list
print(skip_elements(['a','b','c','d','e','f','g'])) #display
Following are the description of the code:
- In this we declared a function skip_elements .In this function we pass the parameter into them .
- After that we declared the new_list array.
- Declared the variable "i" that are initialized with the 0 value .
- Iterating over the for loop and this loop we check the condition in the if condition.
- The if condition executed when the index is even .The statement inside the if condition we will appending the list and returning the list item .
- Finally we print the even number of index list .
Answer:
The solution code is as below:
- Scanner input = new Scanner(System.in);
- System.out.print("Input a string: ");
- String inStr = input.nextLine();
- int strLen = inStr.length();
-
- while(inStr.equals("Quit") != true && inStr.equals("quit") !=true && inStr.equals("q") != true){
-
- for(int i= 0; i < strLen; i++){
- System.out.print(inStr.charAt(strLen - 1 - i));
- }
-
- System.out.println();
- System.out.print("Input a string: ");
- inStr = input.nextLine();
- strLen = inStr.length();
Explanation:
Firstly, we create a Scanner object,<em> input</em> (Line 1).
Next, we use the Scanner object nextLine() method to get a text input from user (Line 3).
We create a while loop and set the condition so long as the input text is not equal to "Quit", "quit" or "q" (Line 6), the program should proceed to print the input text in reverse (Line 8-10). To print the text in reverse, we can apply the expression<em> length of string - 1 - current index</em>. This will ensure the individual letter is read from the last and print the text in reverse.
Next, prompt the user to input a new text (Line 13-14) and repeat the same process of printing text in reverse so long as the current input text is not "Quit", "quit" or "q".
Answer:
When you first open IDLE, you can use the float() function
Explanation:
i bellive this is the rigtht anser but i am not 100%