python please
• A method named display (self) which displays the stock pile with one upturned card and n-1 downturned car You should print the cards starting with a letter "S" where "S" represents the "stock" pile. Note - keep a copy of your solution to this task because you will be extending it step by step in subsequent tasks. For example: Test Result [1, 3, 5, 0, 2, 4] False 6 S: 1 * * * * * Testing for an empty stock ok random.seed(30) S = Stock(6) print(s) print(s.is_empty()) print(s.size()) s.display() s2 = Stock() print('Testing for an empty stock', s2, 'ok') S = Stock() s.push_list( [2, 5, 1, 4, 3, 01) print(s) print(s.is_empty()) print(s.size()) s.display(). [2, 5, 1, 4, 3, 0] False 6 S: 2 * * * * * S: S = Stock() S.display() print(s.is_empty()) True
• A method named display (self) which displays the stock pile with one upturned card and n-1 downturned car You should print the cards starting with a letter "S" where "S" represents the "stock" pile. Note - keep a copy of your solution to this task because you will be extending it step by step in subsequent tasks. For example: Test Result [1, 3, 5, 0, 2, 4] False 6 S: 1 * * * * * Testing for an empty stock ok random.seed(30) S = Stock(6) print(s) print(s.is_empty()) print(s.size()) s.display() s2 = Stock() print('Testing for an empty stock', s2, 'ok') S = Stock() s.push_list( [2, 5, 1, 4, 3, 01) print(s) print(s.is_empty()) print(s.size()) s.display(). [2, 5, 1, 4, 3, 0] False 6 S: 2 * * * * * S: S = Stock() S.display() print(s.is_empty()) True
Define a class named Stock which represents the stock (hand) pile in the simplified Klondike Solitaire game. The Stock class contains the following: • A data field named items that defines the list of cards in the stock pile. Each card in the deck is represented by a unique number and these numbers range from 0 ton - 1 where n is the total number of cards. • A constructor/initializer that takes the total number of cards as a parameter and creates a Stock pile. The default value of the total number of cards is O. If the total number of cards is bigger thate on the initializer should insert integers from 0 to n - 1 where n is the total number of cards. The initializer should also use the random.shuffle() method to shuffle the numbers in the stock pile. • A method named push_list(self, values) which takes a Python List as a parameter and inserts all elements into the stock pile. • A method named is_empty(self) which returns True if the stock pile is empty, and False otherwise. • A method named size(self) which returns the number of items in the stock pile. • A method named_str_(self) which returns the string representation of the stock pile as shown in the examples below • A method named display(self) which displays the stock pile with one upturned card and n-1 downturned cards. You should print the cards starting with a letter "S" where "S" represents the "stock" pile. a Note - keep a copy of your solution to this task because you will be extending it step by step in subsequent tasks. For example: Test Result random.seed (30) S = Stock(6) print(s) print(s.is_empty() print(s.size() s.display() S2 = Stock print('Testing for an empty stock', 52, 'ok') [1, 3, 5, 0, 2, 4] False 6 S: 1 * * * * * Testing for an empty stock ok ㅎ
• A method named display (self) which displays the stock pile with one upturned card and n-1 downturned car You should p
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
• A method named display (self) which displays the stock pile with one upturned card and n-1 downturned car You should p
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!