Given the following list:
tokens = [ 'wind', 'rain', 'lightning' ]
Please write a loop to print out all the list elements
tokens = ['wind', 'rain', 'lightning'] for element in tokens: print(element)
Given the following list: tokens = [ 'wind', 'rain', 'lightning' ] Please write a loop to...
Please use Pyton 3 19. Write a for-loop to perform each of the following actions Print out every item in a 2D list Print out the first letter in the first item in a list, 2nd letter in the 2nd item in the list, 3rd letter in the 3rd item, etc Create a 4x4 2D list that counts up from 1-16 . . o Writ ach ofthese fnetions and correctlv use them in mainQ:
Task 1: String with Loop • Write a program that reads a sentence and use a loop that counts how many elements in a string that are equal to ‘t’. Task 2: List with Function • Write a function fill that fills all elements of a list with a given value. • For example: o The call fill(scores, 13) should fill all elements of the list scores with the value 13. • Write a demo program to show how this...
Write a for-loop that will loop the following salaries in the list s, sum the salaries, find the average salary, and print the value of the average salary. #complete the code below with your solution sum = 0 n = 0 s = [28000, 42500, 32600, 29700]
c++ please Given the following skeleton of an unsorted list class that uses an unsorted linked list: template<class ItemType> struct NodeType { ItemType item; NodeType* next; }; template<class ItemType> class UList { public: UList(); // default constrctor UList(const UList &x); // we implement copy constructor with deep copy UList& operator = (UList &x); // equal sign operator with deep copy bool IsThere(ItemType item) const; // return true of false to indicate if item is...
Write a program that incorporates these functions and statements: • list • while loop • for loop • if • print() • input() • concatenation This program must create a grocery shopping list based on the user input • the program will ask a user to enter a new grocery item until the user presses Enter • then all user input will be added to a list • then the list with all grocery items will be printed
Write a complete Java program in a file caled Module1Progrom.java that reads all the tokens from a file named dota.txt that is to be found in the same directory as the running program. The program should ignore al tokens that cannot be read as an integer and read only the ones that can. After reading all of the integers, the program should print all the integers back to the screen, one per line, from the smalest to the largest. For...
write a java program that will perform the following. Given two finite sets, list all elements in the Cartesian product of these two sets. Given a finite set, list all elements of its power set.
please help 7.(10) a. What are the four parts of a loop? (10) b. Given the following, what will print out? sum = 1; snt = 0; do sum - sum + cnt: snt=sum + 2; } while ( nt < 10) sout << "sum="<< sum << "snt="<<ent <endl; (5) b. Is the above a good way to write a loop? Explain. (Think of parts of a loop.)
C programming only please 5.2.3: Printing array elements with a for loop. Write a for loop to print all elements in courseGrades, following each element with a space (including the last). Print forwards, then backwards. End each loop with a newline. Ex: If courseGrades = {7, 9, 11, 10}, print: 7 9 11 10 10 11 9 7 Hint: Use two for loops. Second loop starts with i = NUM_VALS - 1. (Notes) Note: These activities may test code with...
in c++ language 1.Re-write the following for loop statement by using a while loop statement: int sum = 0; for(int i=0;i<=1000;i++){ sum+=i; } 1 (b). Following is the main () function of a program. The program asks a user to enter 150 integers and print the largest integer user entered. int main() { int score, highest; //missing portion of the program return 0; } 1(c). Find the missing portion of the following code, so the...