subject

Write a function called 'game_of_eights()' that accepts a list of numbers as an argument and then returns 'True' if two consecutive eights are found in the list. For example: [2,3,8,8,9] -> True. The main() function will accept a list of numbers separated by commas from the user and send it to the game_of_eights() function. Within the game_of_eights() function, you will provide logic such that: the function returns True if consecutive eights (8) are found in the list; returns False otherwise. the function can handle the edge case where the last element of the list is an 8 without crashing. the function prints out an error message saying 'Error. Please enter only integers.' if the list is found to contain any non-numeric characters. Note that it only prints the error message in such cases, not 'True' or 'False'. Examples: Enter elements of list separated by commas: 2,3,8,8,5 True Enter elements of list separated by commas: 3,4,5,8 False Enter elements of list separated by commas: 2,3,5,8,8,u Error. Please enter only integers. Hint: You will need to use try-except to catch exceptions.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:00
Wich technology can a website use to allow you to listen to a concert live over the internet?
Answers: 3
question
Computers and Technology, 22.06.2019 18:30
Which of the following commands is more recommended while creating a bot?
Answers: 1
question
Computers and Technology, 22.06.2019 19:20
1)consider the following code snippet: #ifndef book_h#define book_hconst double max_cost = 1000.0; class book{public: book(); book(double new_cost); void set_cost(double new_cost); double get_cost() const; private: double cost; }; double calculate_terms(book bk); #endifwhich of the following is correct? a)the header file is correct as given.b)the definition of max_cost should be removed since header files should not contain constants.c)the definition of book should be removed since header files should not contain class definitions.d)the body of the calculate_terms function should be added to the header file.
Answers: 1
question
Computers and Technology, 23.06.2019 01:30
In deadlock avoidance using banker’s algorithm, what would be the consequence(s) of: (i) a process declaring its maximum need as maximum possible for each resource. in other words, if a resource a has 5 instances, then each process declares its maximum need as 5. (ii) a process declaring its minimum needs as maximum needs. for example, a process may need 2-5 instances of resource a. but it declares its maximum need as 2.
Answers: 3
You know the right answer?
Write a function called 'game_of_eights()' that accepts a list of numbers as an argument and then re...
Questions
question
Business, 25.01.2022 03:20
question
Chemistry, 25.01.2022 03:20
question
Mathematics, 25.01.2022 03:20
Questions on the website: 13722362