PYTHON PROGRAMMING HELP PLEASE.Create a program in Python that reads the contents of two files, names.txt and age.txt, and stores the results in two separate lists.Copy the age_list to a new list called age_list_new.Sort the age_list_new.Make a new list called name_list_new and add the names to it in such a way that the order of the names corresponds to the age of the people in the age_list_new list.Write the content of age_list_new and name_list_new into two separate files name sorted_age.txt and sorted_names.txt.Consider all the exceptions may be raised in the program. Your code should have the name of at least two exception.
![Title: Card Game Simulation using Stack and Deck Description: Create a program that simulates a simple card game using a stack and a deck of cards. The objective of the game is to implement basic card manipulation operations using stacks and to showcase the fundamental principles of a deck-based game. Suggested list of data structures: 1. Use a struct or class to store data about each card: struct Card { string suit; string rank; } 2. Use the following arrays or an alternative data structure for each of the following: a. Deck: An array to store the initially created deck of cards Card deck[52] b. Suits: An array to store the list of suits e.g., string suits[] = {"Hearts", "Diamonds", "Clubs", "Spades"} c. Ranks: An array to store the following ranks: string ranks[] = {"2", "3", "4", "5", "6", "7", "8","9","10","Jack","Queen","King", "Ace"} d. A stack to store the cards to be dealt. Struct cardsStack {} e. An array named hand that tracks 5 cards (handSize) given to the player. 3. You may also need to declare the following integer values: a. numberOfCards = 52 b. numberOfRanks = 13 c. numberOfSuits = 4 d. handSize = 5 Include the following functions: 1. Create an array of type Card, which holds a deck of standard playing cards (52 cards: 4 suits - hearts, diamonds, clubs, spades; each suit with cards 2 through 10, Jack, Queen, King, Ace). 2. Shuffle: randomly shuffle the deck of cards. 3. Store the cards in a stack using push. 4. DealCards: pop 5 cards from the deck of cards into an array of cards (hand) e.g., Hand[handSize] 5. Create a function to evaluate the user's hand by adding the corresponding values: The total value for a hand of 5 cards is between 11 and 69. 6. Generate a random number between 11 and 69 to represent the value of 5 cards played by the computer. 7. Compare the randomly generated value that represents the computer's score to the total value of cards held in the player's hand. The higher score wins. Output: 1. Print the deck of cards before shuffling 2. Print the deck of cards after shuffling 3. Print the player's hand and the randomly generated score for the computer 4. Evaluate and print the winner.](https://gotit-pro.com/wp-content/uploads/2023/10/ccd899b7-a388-49a5-aaa2-adf378ed1a05-300x397.png)
![How do you declare a variable for two-dimensional arrays? How do you create a two-dimensional array? How do you access elements in a two-dimensional array? This section will address these issues. 8.2.1 Declaring Variables of Two-Dimensional Arrays and Creating Two-Dimensional Arrays The syntax for declaring a two-dimensional array is as follows: elementType[][] arrayRefVar; or elementType arrayRefVar[][]; // Allowed, but not preferred As an example, here is how you would declare a two-dimensional array variable matrix of int values: int[][] matrix; or int matrix[][]; // This style is allowed, but not preferred You can create a two-dimensional array of 5-by-5 int values and assign it to matrix using this syntax: Figure 8.2 8.2.3 Ragged Arrays Each row in a two-dimensional array is itself an array. Thus, the rows can have different lengths. An array of this kind is known as a ragged array. Here is an example of creating a ragged array: 8.2-3 As you can see, triangleArray[0].length is 5, triangleArray[1].length is 4, triangleArray[2].length is 3, triangleArray[3].length is 2, and triangleArray[4].length is 1. If you don't know the values in a ragged array in advance, but do know the sizes-say, the same as in the preceding figure-you can create a ragged array using the following syntax: Two subscripts are used in a two-dimensional array: one for the row, and the other for the column. The two subscripts are conveniently called row index and column index. As in a one-dimensional array, the index for each subscript is of the int type and starts from 0, as shown in Figure 8.1a. row index column index Figure 8.1 The index of each subscript of a two-dimensional array is an int value, starting from 0. Figure 8.1 To assign the value 7 to a specific element at row index 2 and column index 1, as shown in Figure 8.1b, you can use the following syntax: A Caution It is a common mistake to use matrix[2,1] to access the element at row 2 and column 1. In Java, each subscript must be enclosed in a pair of square brackets. You can also use an array initializer to declare, create, and initialize a two-dimensional array. For example, the following code in (a) creates an array with the specified initial values, as shown in Figure 8.1c. This is equivalent to the code in (b). 8.2-2 8.2.2 Obtaining the Lengths of Two-Dimensional Arrays A two-dimensional array is actually an array in which each element is a one-dimensional array. The length of an array x is the number of elements in the array, which can be obtained using x.length. x[0], x[1], ..., and x[x.length - 1] are arrays. Their lengths can be obtained using x[0].length, x[1].length, ..., and x[x.length - 1].length. For example, suppose that x = new int[3][4], x[0], x[1], and x[2] are one-dimensional arrays and each contains four elements, as shown in Figure 8.2. x.length is 3, and x[0].length, x[1].length, and x[2].length are 4. Figure 8.2 A two-dimensional array is a one-dimensional array in which each element is another one-dimensional array. Ant: [[] z = langlahrazy - new int[5][]; triangleArray[3] = new int[2]; triangleArray[4] = new int[1]; You can now assign values to the array. For example, Note: The syntax new int[5][] for creating an array requires the first index to be specified. The syntax new int[][] would be wrong. Check Point: 8.2.1 Declare an array reference variable for a two-dimensional array of int values, create a 4by5 int matrix, and assign it to the variable. 8.2.2 Which of the following statements are valid? Ant: [] = new int[2]; int[] x = new int[]; int[][] y = new int[3][]; int[][] z = {{1, 2}}; int[][] w = {{1, 2}, {2, 3}}; int[][] v = { {1, 2}, {2, 3}};](https://gotit-pro.com/wp-content/uploads/2023/10/f06297d6-186a-4809-8104-7383e1be49f5-300x425.png)
PYTHON PROGRAMMING HELP PLEASECreate a program in Python that reads the contents of two files
Original price was: $10.00.$5.00Current price is: $5.00.
-50%Download button will appear immediately after successful payment.
Full support will be provided with necessary files installation.
Get impeccable customized solution within 24 hours, hassle-free.
Ravi Harrichand –
Work was finished long before due and tutor was considerate and engaging. Perfect!
Kirsten Gorby –
I really love the quality of the assignments. They are great so far. Accurate.