In Pyhton Write A Function Called IsStringLengthEven() That Accepts One Argument Of Type String.
in pyhton Write a function called isStringLengthEven() that accepts one argument of type string. The function should return True (the boolean value, not the string!) if the length of the string is even, and return False if the length of the string is odd. I hope it’s obvious that you will need to use an if/else statement here. You can see the example above for an idea of how to do it. Example: print(isStringLengthEven(‘hi’)) à would output True print(isStringLengthEven(‘bye’)) à would output False
PYTHON 3 Object Oriented Programming *Only Need Questions 4-6 ***a9q3.py File Below*** Class GradeItem(object):
PYTHON 3 Object Oriented Programming *Only need questions 4-6 ***a9q3.py file below*** class GradeItem(object): # A Grade Item is anything a course uses in a grading scheme, # like a test or an assignment. It has a score, which is assessed by # an instructor, and a maximum value, set by the instructor, and a weight, # which defines how much the item counts towards a final grade. def __init__(self, weight, scored=None, out_of=None): “”” Purpose: Initialize the GradeItem object. Preconditions: :param weight: the weight of the GradeItem in a grading scheme :param scored: the scored obtained in the grade item :param out_of: the maximum possible score for the grade item “”” self.weight = weight self.scored = scored self.out_of = out_of def __str__(self): “”” Purpose: Represent the Grade object as a string. If the item has not been assessed yet, N/A is used. This function gets called by str(). Return: A string representation of the Grade. “”” if self.scored is None or self.out_of is None: return ‘N/A’ else: return str(self.scored) ‘/’ str(self.out_of) def record_outcome(self, n, d): “”” Purpose: Record the outcome of the GradeItem. Preconditions: :param n: The score obtained on the item :param d: The maximum score on the item Post-conditions: Changes the data stored in the GradeItem Return: None “”” self.scored = n self.out_of = d def contribution(self): “”” Purpose: Calculate and return the contribution this GradeItem makes to a grading scheme. If the item has not been assessed, a value of zero is returned. Return: The weighted contribution of the GradeItem. “”” if self.scored is None or self.out_of is None: return 0 else: return self.weight * self.scored / self.out_of class StudentRecord(object): def __init__(self, first, last, st_number): “”” Purpose: Initialize the Student object. Preconditions: :param first: The student’s first name, as a string :param last: The student’s last name, as a string :param st_number: The student’s id number, as a string “”” self.first_name = first self.last_name = last self.id = st_number self.midterm = None self.labs = [] def drop_lowest(self, grades): “”” Purpose: Sets the weight of the lowest grade in grades to zero. Pre-conditions: :param grades: a list of GradeItems Post-conditions: One of the grade items has its weight set to zero Return: :return: None “”” pass def calculate(self): “”” Purpose: Calculate the final grade in the course. Return: The final grade. “”” return round(self.midterm.contribution() sum([b.contribution() for b in self.labs])) def display(self): “”” Purpose: Display the information about the student, including all lab and assignment grades, and the calculation of the total grade. :return: “”” print(“Student:”, self.first_name, self.last_name, ‘(‘ self.id ‘)’) print(“tCourse grade:”, self.calculate()) print(‘tMidterm:’, str(self.midterm)) # print(‘tLabs:’, end=” “) for g in self.labs: if g.weight == 0: print(‘[‘ str(g) ‘]’, end=’ ‘) else: print(str(g), end=’ ‘) print() def read_student_record_file(filename): “”” Purpose: Read a student record file, containing information about the student. Line 1: Out of: the maximum score for the grade items Line 2: Weight: the weight of the grade items in the grading scheme Lines 3…: Student records as follows: Student Number, Lastname, Firstname, 10 lab marks, 10 assignment marks, midterm, final Pre-conditions: :param filename: A text file, comma-separated, with the above format. Return: :return: A list of StudentRecords constructed from the named file. “”” f = open(filename) # Second line tells us what the grade items are out of out_of_line = f.readline().rstrip().split(‘,’) out_of = [int(i) for i in out_of_line[1:]] lab_out_of = out_of[0:10] assignments_out_of = out_of[10:20] mt_out_of = out_of[20] final_out_of = out_of[21] # Third line tells us the weight of each item weight_line = f.readline().rstrip().split(‘,’) weights = [int(i) for i in weight_line[1:]] lab_weights = weights[0:10] assignment_weights = weights[10:20] mt_weight = weights[20] final_weight = weights[21] # Read all the students in the file: students = list() for line in f: student_line = line.rstrip().split(‘,’) student = StudentRecord(student_line[2],student_line[1],student_line[0]) labs = [int(lab) for lab in student_line[3:13]] assignments = [int(a) for a in student_line[13:23]] for g,o,w in zip(labs,lab_out_of,lab_weights): student.labs.append(GradeItem(w,g,o)) student.midterm = GradeItem(mt_weight,int(student_line[23]),mt_out_of) students.append(student) return students if __name__ == ‘__main__’: course = read_student_record_file(‘students.txt’) # display the students print(‘————- Before —————‘) for s in course: s.display() # drop lowest lab for all students for s in course: s.drop_lowest(s.labs) # display the students print(‘————- After —————-‘) for s in course: s.display() ***Students.txt file below*** Out of,4,4,4,4,4,4,4,4,4,4,41,50,35,60,70,55,45,50,60,60,60,90 Weights,1,1,1,1,1,1,1,1,1,1,4,4,4,4,4,4,4,4,4,4,10,40 3111332,Einstein,Albert,4,4,3,4,4,3,4,3,3,4,39,46,34,58,65,45,25,10,40,35,35,50 3216842,Curie,Marie,3,4,3,4,3,4,1,4,1,4,41,45,30,50,61,48,37,43,55,58,55,85 **The solution code returns 78.5 of avg when the lowest grades are NOT dropped from the student.txt file. On the other hand, if they ARE dropped for BOTH labs and assignments, the avg becomes 80.5
If You Are The Person Who Answered This Incorrectly Four Times Now Do Not
If you are the person who answered this incorrectly four times now do not answer this question. The gain is supposed to be 39M if that isn’t your answer the work isn’t right.
What Is Issue Management, And Why Is It Important For Software Product Development?
What is issue management, and why is it important for software product development?
PYTHON 3 Object Oriented Programming *ONLY QUESTION 5 **a9q3.py File Below** Class GradeItem(object): #
PYTHON 3 Object Oriented Programming *ONLY QUESTION 5 **a9q3.py file below** class GradeItem(object): # A Grade Item is anything a course uses in a grading scheme, # like a test or an assignment. It has a score, which is assessed by # an instructor, and a maximum value, set by the instructor, and a weight, # which defines how much the item counts towards a final grade. def __init__(self, weight, scored=None, out_of=None): “”” Purpose: Initialize the GradeItem object. Preconditions: :param weight: the weight of the GradeItem in a grading scheme :param scored: the scored obtained in the grade item :param out_of: the maximum possible score for the grade item “”” self.weight = weight self.scored = scored self.out_of = out_of def __str__(self): “”” Purpose: Represent the Grade object as a string. If the item has not been assessed yet, N/A is used. This function gets called by str(). Return: A string representation of the Grade. “”” if self.scored is None or self.out_of is None: return ‘N/A’ else: return str(self.scored) ‘/’ str(self.out_of) def record_outcome(self, n, d): “”” Purpose: Record the outcome of the GradeItem. Preconditions: :param n: The score obtained on the item :param d: The maximum score on the item Post-conditions: Changes the data stored in the GradeItem Return: None “”” self.scored = n self.out_of = d def contribution(self): “”” Purpose: Calculate and return the contribution this GradeItem makes to a grading scheme. If the item has not been assessed, a value of zero is returned. Return: The weighted contribution of the GradeItem. “”” if self.scored is None or self.out_of is None: return 0 else: return self.weight * self.scored / self.out_of class StudentRecord(object): def __init__(self, first, last, st_number): “”” Purpose: Initialize the Student object. Preconditions: :param first: The student’s first name, as a string :param last: The student’s last name, as a string :param st_number: The student’s id number, as a string “”” self.first_name = first self.last_name = last self.id = st_number self.midterm = None self.labs = [] self.final_exam = None self.assignments = [] def drop_lowest(self, grades): “”” Purpose: Sets the weight of the lowest grade in grades to zero. Pre-conditions: :param grades: a list of GradeItems Post-conditions: One of the grade items has its weight set to zero Return: :return: None “”” pass def calculate(self): “”” Purpose: Calculate the final grade in the course. Return: The final grade. “”” return round(self.midterm.contribution() (self.final_exam.contribution() sum ([b.contribution for b in self.assignments])) sum([b.contribution() for b in self.labs])) def display(self): “”” Purpose: Display the information about the student, including all lab and assignment grades, and the calculation of the total grade. :return: “”” print(“Student:”, self.first_name, self.last_name, ‘(‘ self.id ‘)’) print(“tCourse grade:”, self.calculate()) print(‘tMidterm:’, str(self.midterm)) print(‘tMidterm:’, str(self.final_exam)) print(‘tMidterm:’, str(self.assignments)) # print(‘tLabs:’, end == ” “) for g in self.labs: if g.weight == 0: print(‘[‘ str(g) ‘]’, end == ‘ ‘) else: print(str(g), end == ‘ ‘) print() def read_student_record_file(filename): “”” Purpose: Read a student record file, containing information about the student. Line 1: Out of: the maximum score for the grade items Line 2: Weight: the weight of the grade items in the grading scheme Lines 3…: Student records as follows: Student Number, Lastname, Firstname, 10 lab marks, 10 assignment marks, midterm, final Pre-conditions: :param filename: A text file, comma-separated, with the above format. Return: :return: A list of StudentRecords constructed from the named file. “”” f = open(filename) # Second line tells us what the grade items are out of out_of_line = f.readline().rstrip().split(‘,’) out_of = [int(i) for i in out_of_line[1:]] lab_out_of = out_of[0:10] assignments_out_of = out_of[10:20] mt_out_of = out_of[20] final_out_of = out_of[21] # Third line tells us the weight of each item weight_line = f.readline().rstrip().split(‘,’) weights = [int(i) for i in weight_line[1:]] lab_weights = weights[0:10] assignment_weights = weights[10:20] mt_weight = weights[20] final_weight = weights[21] # Read all the students in the file: students = list() for line in f: student_line = line.rstrip().split(‘,’) student = StudentRecord(student_line[2],student_line[1],student_line[0]) labs = [int(lab) for lab in student_line[3:13]] assignments = [int(a) for a in student_line[13:23]] for g,o,w in zip(labs,lab_out_of,lab_weights): student.labs.append(GradeItem(w,g,o)) student.midterm = GradeItem(mt_weight,int(student_line[23]),mt_out_of) students.append(student) return students if __name__ == ‘__main__’: course = read_student_record_file(‘students.txt’) # display the students print(‘————- Before —————‘) for s in course: s.display() # drop lowest lab for all students for s in course: s.drop_lowest(s.labs) # display the students print(‘————- After —————-‘) for s in course: s.display() **Students.txt file below** Out of,4,4,4,4,4,4,4,4,4,4,41,50,35,60,70,55,45,50,60,60,60,90 Weights,1,1,1,1,1,1,1,1,1,1,4,4,4,4,4,4,4,4,4,4,10,40 3111332,Einstein,Albert,4,4,3,4,4,3,4,3,3,4,39,46,34,58,65,45,25,10,40,35,35,50 3216842,Curie,Marie,3,4,3,4,3,4,1,4,1,4,41,45,30,50,61,48,37,43,55,58,55,85 **The solution code returns 78.5 of avg when the lowest grades are NOT dropped from the student.txt file. On the other hand, if they ARE dropped for BOTH labs and assignments, the avg becomes 80.5
Mini Project You Are Required To Do This Assignment On Your Own Skills. No
Mini Project You are required to do this assignment on your own skills. No copying from other students are not allowed. Write a menu driven Bash script using the guidelines given below. Some of the commands and syntax may not be covered in lectures. Please refer other sources to understand syntax and commands you need to complete this assignment. This program takes user input and to perform simple arithmetic operations such as addition, subtraction, multiplication and division of any two integers. Part I Script should contain the following tasks: Script file name: math.sh Clear the screen. Enter appropriate comments or descriptions Ask the user to input a value for each arithmetic calculations; for example, 1 for addition and 2 for subtraction, so on. Use a case statement condition and the user input, complete arithmetic operations. Print the result on the screen. Part II Test your program. Give proper execute permission to run the script Part III Project Submission Information There are two ways you can submit your mini project. First option: Include your screen shot of your script and the output of the script. Output for each operation should be included Second Option: Upload your script to the Blackboard Resources: Lot resources and scripts are available on the Web.
Use The C# Programming Language To Complete Public Class StringOrder { Enum Order {
Use the C# programming language to complete public class StringOrder { enum Order { Precedes=-1, Equals=0, Follows=1 }; public static void Main() { Console.WriteLine(“What is name A?”); } }
Question 2 A) Sketch A Local Area Network (LAN) With 3 Hosts In Subnet
Question 2 a) Sketch a Local Area Network (LAN) with 3 hosts in subnet A linked to a router R that connects this subnet to a subnet B with 2 hosts. Provide fictitious Layer 2 and Layer 3 addresses (but using the correct format/representation) for all the hosts and the router. The router has only 2 interfaces: [5 marks] b) Suppose nodes A, B and C each attach to the same broadcast LAN. If A sends thousands of IP packets to B with each encapsulated frame addressed to the MAC address of B, will C’s adapter process these frames? If so, will C’s adapter pass the IP packet in these frames to the network layer of C? How would your answers change if A sends frames with the MAC broadcast address? [6 marks] c) Answer the following questions about multiple access protocols: i) We learned that an ideal multiple access protocol has FOUR desirable characteristics, describe them. ii) Which of these four desirable characteristics does pure ALOHA have? iii) Which of these four desirable characteristics does Token Passing have? [8 marks] d) Why does collision occur in CSMA, if all nodes perform carrier sensing before transmission? [4 marks] e) Name TWO types of Ethernet Topologies. Note: You are required to write only computer network topologies that apply to the Ethernet protocol.
Draw An ERD For The Following Scenario. The Employees Of A Company Are Assigned
Draw an ERD for the following scenario. The employees of a company are assigned to departments. Each department has a single, unique employee who is the department’s head. The department’s head supervises the other employeesin the department. Each employee is engaged in one or more projects. A team of employees can be engaged in a single project, but each team must be drawn from the employees of a single department. Parts are required for the assembly of each project, and these parts are obtained from external supplying companies. A single such company can supply many different parts, but each type of part can only be obtained from a single supplying company. Remember to include assumptions, and any arguments that helped you to decide what entities and relationships exist in the model.
Hi There I Need Help Writing An Algorithm To Solve Sudoku Puzzles Through Integer
Hi there I need help writing an algorithm to solve Sudoku puzzles through integer linear programming using MATLAB. The method must utilize a branch and bound approach. If you could please provide the code and an explanation of how it works I’d be really grateful. Any assistance would be much appreciated, many thanks in advance!
What Is The Basic Definition Of Sexual Harassment In The Workplace? What Are Two
what is the basic definition of Sexual Harassment in the workplace? What are two main types of Sexual Harassment in the workplace – how do they differ (give one example)
Write A Short UDP-based Client/server System That Sends Messages (using Sendto() And Recvfrom()) To
Write a short UDP-based client/server system that sends messages (using sendto() and recvfrom()) to each other with the server doing simple processing on the message before replying. This should use C programming language. The simple processing is a server accepting a UDP message consisting of a text string sent to it by the client process. The system should use command line arguments, such that, when a user types a string into the client command line interface, the server will receive it. Thanks very much!
1a) Based On Your Understanding What Is A Preprocessor Directive? Is #include The Only
1a) Based on your understanding what is a preprocessor directive? Is #include the only preprocessor directive? How does the #include work and how is it different than import in Java? What is ANSI standard C ? Why is it important? What is a namespace? Briefly describe the C translation process? How is the C translation process you described above different than the translation process for Java? (Remember this is not graded on perfect answers so try your best if you’re not sure) Is C a compiled or interpreted language? How is this different than Java?
Basically I Have Not Write A Console Based Boogle Game With The DiceTray Given.
Basically i have not write a console based Boogle Game with the DiceTray Given. BoggleConsole.java package view_controller; import model.DiceTray; public class BoggleConsole { public static void main(String[] args) { // Use this for testing char[][] a = { { ‘A’, ‘B’, ‘S’, ‘E’ }, { ‘I’, ‘M’, ‘T’, ‘N’ }, { ‘N’, ‘D’, ‘E’, ‘D’ }, { ‘S’, ‘S’, ‘E’, ‘N’ }, }; DiceTray tray = new DiceTray(a); // TODO: Complete a console game } } Boggle.java package model; public class Boggle { // TODO: Complete a Boggle game that will be used with views // 1. A console based game with standard IO (Boggle Two) } DiceTray.java package model; /** * Model the tray of dice in the game Boggle. A DiceTray is * constructed here a 4×4 array of characters for testing. * */ public class DiceTray { private char[][] path; private char[][] board; public static final char TRIED = ‘@’; public static final char PART_OF_WORD = ‘!’; private String attempt; private int index; public static final int SIZE = 4; /** * Construct a tray of dice using a hard coded 2D array of chars. Use this for * testing * * @param newBoard * The 2D array of characters used in testing */ public DiceTray(char[][] newBoard) { board = newBoard; } /** * Return true if search is word that can found on the board following the rules * of Boggle * * @param str * A word that may be in the board by connecting consecutive letters * @return True if search is found */ public boolean foundInBoggleTray(String str) { if (str.length() < 3) return false; attempt = str.toUpperCase().trim(); boolean found = false; for (int r = 0; r < SIZE; r ) { for (int c = 0; c < SIZE; c ) if (board[r][c] == attempt.charAt(0)) { init(); found = recursiveSearch(r, c); if (found) { return true; } } } return found; } // Keep a 2nd 2D array to remember the characters that have been tried private void init() { path = new char[SIZE][SIZE]; for (int r = 0; r < SIZE; r ) for (int c = 0; c = attempt.length()) found = true; else { found = recursiveSearch(r – 1, c – 1); if (!found) found = recursiveSearch(r – 1, c); if (!found) found = recursiveSearch(r – 1, c 1); if (!found) found = recursiveSearch(r, c – 1); if (!found) found = recursiveSearch(r, c 1); if (!found) found = recursiveSearch(r 1, c – 1); if (!found) found = recursiveSearch(r 1, c); if (!found) found = recursiveSearch(r 1, c 1); // If still not found, allow backtracking to use the same letter in a // different location later as in looking for “BATTLING” in this board // // L T T X // Mark leftmost T as untried after it finds a 2nd T but not the L. // I X A X // N X X B // G X X X // if (!found) { path[r][c] = ‘.’; // Rick used . to mark the 2nd 2D array as TRIED index–; // 1 less letter was found. Let algorithm find the right first (col 2) } } // End recursive case if (found) { // Mark where the letter was found. Not required, but could be used to // show the actual path of the word that was found. path[r][c] = board[r][c]; } } return found; } // Determine if a current value of row and columns can or should be tried private boolean valid(int r, int c) { return r >= 0
Give 10 Advantages And Disadvantages Of Agile Software Development Against Conventional Process Method In
Give 10 Advantages and Disadvantages of Agile Software development against conventional process method in a tabular form
Write A C Program That Calculates And Prints The Bill For Cellular Telephone Company.
Write a c program that calculates and prints the bill for cellular telephone company. The company offers two types of service: regular and premium. Its rates vary, depending of the type of service. The rates are computed as follows: Regular Service: P10.00 plus first 50 minutes are free. Charges for over 50 minutes are P.50 per minute Premium Service: 25.00 plus: a. For calls made from 6:00 am to 5:59pm., the first 75 minutes are free; charges for over 75 minutes are P.10 per minute b. For calls made from 6:00 am to 5:59pm., the first 100 minutes are free; charges for over 100 minutes are P.15 per minute Your program should prompt the user to enter an account number, a service code, and the number of minutes the service was used. A service code or r or R means a regular service; a service of p or P means premium service. Treat any other character as an error. Your program should output the account number, type of service , number of minutes the telephone service was used, and the amount due from the user.
Write A C Program To Calculate The Parking Fare For Customers Who Park Their
write a c program to calculate the parking fare for customers who park their cars in a parking … Question: Write a C program to calculate the parking fare for customers who park their cars in a parking … Write a C program to calculate the parking fare for customers who park their cars in a parking lot when the following information is given: a. A character showing the type of vehicle: C for car, B for bus, and T for truck. b. An integer between 0 and 24 showing the hour the vehicle entered the lot. c. An integer between 0 and 60 showing the minute the vehicle entered the lot d. An integer- between 0 and 24 showing the hour the vehicle left the lot e. An integer between 0 and 60 showing the minute the vehicle left the lot Management uses two different rates for each type of vehicle as shown below: VEHICLE FIRST RATE SECOND RATE Car P 0.0 / HR first 3 hrs P 1.50 / HR after 3 hrs Truck P 10.0 / HR first 2 hrs P 5.0 / HR after 2 hrs Bus P 20.0 / HR first hr P 10.0 / HR after 2 hrs No vehicle is allowed to stay in the lot later than midnight; any vehicle that remains past midnight will be towed away. Following is a sample screen input (Bold Italic is used to indicate typical input) Type of vehicle? 1. C – Car 2. B – Bus 3. T – Truck Choose C Hour vehicle entered ( 0 – 24 ) : 8 Minute vehicle entered ( 0 – 24 ) : 15 Hour vehicle left( 0 – 24 ) : 13 Minute vehicle left ( 0 – 24 ) : 0 PARKING LOT CHARGES ( OUTPUT) TYPE OF VEHICLE : CAR TIME-IN : 8:15 AM TIME-OUT : 1:00 PM PARKING TIME : 3:45 HH:mm ROUNDED TOTAL: 4:00 TOTAL CHARGE : P #####.## /* Guys my teacher told me that rounded total only work if it reaches to 30 minutes i think */
Write A Function To Take A Sentence (assume That The Entire Text Is One
Write a function to take a sentence (assume that the entire text is one sentence) and split it into a list of words. We need to be able to split on different punctuation characters (use this list for now: “!,. -tn;: -/,=?@”). Bonus problem: get it running with all characters in string.punctuation plus whitespace characters. [ ]: def split_sentence(line): “””Split a sentence into individual words by splitting at punctuations and whitespace””” # Your code here to return output list x = “this! is,a , sentence…nn” # take care to remove any null strings at the end assert split_sentence(x) == [‘this’, ‘is’, ‘a’, ‘sentence’] x = ‘red blue=purple!’ assert split_sentence(x) == [‘red’, ‘blue’, ‘purple’]
Discuss What You Consider To Be The First And Second Priority In A Sorting
Discuss what you consider to be the first and second priority in a sorting algorithm and justify a key word or phrase to place in the string that is crucial. Provide a short pseudocode example in your discussion post to defend your thoughts. Explain your reasoning for selecting your first and second priorities.
MIndTap C Chapter 9 Defined The Struct StudentType To Implement The Basic Properties Of
MIndTap C Chapter 9 defined the struct studentType to implement the basic properties of a student. Define the class studentType with the same components as the struct studentType, and add member functions to manipulate the data members. (Note that the data members of the class studentType must be private.) Write a program to illustrate how to use the class studentType. Struct studentType: struct studentType { string firstName; string lastName; char courseGrade; int testScore; int programmingScore; double GPA; };
IN Pytrhon Write A Function Called CircleGeometry() That Accepts As Its Argument The Diameter
IN pytrhon Write a function called circleGeometry() that accepts as its argument the diameter of a circle. The function should return a string that indicates the circumference and area of the circle. Note: To create this string, you must use the format string technique as discussed in lecture. Formula for circumference of a circle is: 2*pi*radius. Formula for the area of a circle is pi*radius2. Note that the radius is equal to ½ the diameter. The value for PI is 3.14. Bonus point: For pi, instead of hard coding 3.14, look up how to use constant pi which is available in the math module. You do not have to worry about the number of decimal places. This problem will require you to use concatenation. Example: print( circleGeometry(3) ) should output The area is 7.0685834705770345. The cirumference is: 9.42477796076938. Again: Note that the string returned by this function should be created using a format string. So inside your function, create the string using the format() function, and then have your function return that string.
The post In Pyhton Write A Function Called IsStringLengthEven() That Accepts One Argument Of Type String. appeared first on Smashing Essays.
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"
