Write a Python program that reads each line of an input file temperatures.txt that consists of a town name followed by a set of temperatures. The program will then calculate the maximum, minimum, and average temperature and save them in a file called tempSummary.txt. For example, if the temperatures.txt contains Muscat 25 35 30 40 30 Suhar 20 30 25 25 Salalah 35 45 40 15 16 18
Q: 1. Write a class called Bicycle, which contains two attributes, gear, which describes the type of…
A: class ByCycle: def __init__(self,a,b): self.__gear=a self.__speed=b…
Q: Map and lambda problem 1: Input x = ['can', 'batť, 'cat', 'egg', 'dog'] а. b. Output y=[['c', 'a',…
A: We need to write Python code for mentioned functionality.
Q: The weighted, undirected graph below represents a transit system, in which the vertices are train…
A:
Q: The body mass index (BMI) is calculated as a person's weight (in pounds) times 720, divided by the…
A: BMI is calculated using python by above logical expression
Q: create_numbers_dictionary(numbers) which takes a list of integers as a Define a function called…
A:
Q: Intersection of arrays Soluti Please c = Coding DESCRIPTION Create two numpy arrays a and b with the…
A: Programming instructions: Import numpy. Create two numpy arrays. Use the intersection function.…
Q: Write a python program using while loop to find the sum of the below given series up to n. S=1 /23 +…
A: The problem is about to find the sum of the sequence generated upto a given number of terms.
Q: [2.] Write a code to solve the diffusion equation. Run it with D = 0.03, dt = 0.0001, dæ 0.01 and N…
A: Solution:-- 1)The given question has required for the solution to be provided with the help of the…
Q: Question 2 Write a program which takes two float numbers from the user and check, if first number is…
A: algorithm:- input first and second as floating point number if first>second: first=first+5…
Q: Write a program that first gets integers from input. The input begins with a threshold value. Then,…
A: Hi. Let's move on to the code in the next step. I have included comments in the code that will…
Q: Exercise 7: y = x"(= en In x) Write a function power() (not using math.pow()) • takes 2 numbers as…
A: Algorithm Steps:- 1. Even though the exponent can be calculated in Python using the inbuilt **…
Q: You have a list and a target (number) Write a function, for example, pair(x, y), that takes two…
A: The Python code is given below with code and output screenshots I have used 2 functions pair(X, y)…
Q: a Python program that converts temperature Fahrenheit to Celsius and Celsius to Fahrenheit. The user…
A: Required:
Q: Exercise 6: Area of a Circular Sector Write a function area_of_circular_sector() which • takes 2…
A: In this program question using python We have to calculate area of circular sector using two…
Q: Print each employee, their wages, Hours and gross pay.
A: namesList=['Juan','Rae','Ivanna','Lilly','Robert']; #list to store names…
Q: 23.11 LAB: Toll calculation Toll roads have different fees based on the time of day and on weekends.…
A: Nested if-else is used in function calc_toll() to return toll fee as per details mentioned in the…
Q: A certain college classifies students according to credits earned. A student with less than 7…
A: - We need to code for the class of a college.
Q: List some features of Python
A: Please find the answer below :
Q: Use scipy.stats and matplotlib.pyplot from Python to plot the cdfs of the Gamma(1, 1) and Gamma(2,…
A:
Q: Show that if and only if DFS(Depth-first Search) finds no back edges, the graph being traversed is…
A: Python programming : Python is a deciphered, significant level and broadly useful programming…
Q: Write a program that allows the user to input the r- and y-coordinates of two squares, and then…
A: Sample Response: #python function to check whether suqares are in a grid. If yes, then check whether…
Q: A person is eligible to be a US senator if they are at least 30 years old and have been a US citizen…
A: PROGRAM EXPLANATION Take personage and years of citizenship as input from the user. Now, using the…
Q: Explain what the python code is doing:
A: We have been given a python code we have to explain the each line of the code what the code is…
Q: Given two numbers, N and d as an input. Print the sum of all N digit prime numbers where the digit d…
A: I have designed a python program to solve the above problem Here is the logic - def…
Q: The monthly payment for a given loan pays the principal and the interest. The monthly interest is…
A: #Get the loan amount loan_amount=float(input("Loan Amount: ")) #Get the number of years…
Q: Your inputs should be the number of eye drop medicines, usual waking up time of the patient in a day…
A: Python Program for the above scenario
Q: 2. Loop and Input a) Request two numbers, n1 and n2 from the console. b) n1 and n2 can be any…
A: Code: print("\n\nUSING WHILE LOOP") lower = int(input("\nEnter the lower bound: "))upper =…
Q: Suppose you have two arrays: Arr1 and Arr2. Arrl will be sorted values. For each element v in Arr2,…
A: Step 1:- Program Approach:- 1.Initialization Arr1 = []Arr2 = []num = 0 2.Take the input from the…
Q: On a boring Friday, you are sitting alone in your room. Due to the lockdown, you cannot go out to…
A: Given: On a boring Friday, you are sitting alone in your room. Due to the lockdown, you cannot go…
Q: •Develop a program that has an empty list. Then, have it ask a user five times (use a while loop) to…
A: Introduction: In this question, we are asked to write a python program to enter the 5 names by user…
Q: Describe features of Python.
A: Python: It is the powerful programming language. Effective approach to oop's concept. Python is…
Q: Write a function random_word_in_file (filename) to return a random word from the given file after…
A: the python program is an given below :
Q: Write a function clipped_hist(df, clip_threshold) that plots a histogram of the data after applying…
A: Note: The program is executed on dataset of size 20 for the sake of output. You can change the range…
Q: Print the following pattern for the given input (you must use recursion): Sample Input: 5 Sample…
A: Read input n from the user. Then declare temporary variables k, j Iterate the loop from o to n(given…
Step by step
Solved in 2 steps
- Write a Python program that reads a text file called student.txt. The input text file contains student_ID, student_name, Quiz_grade as well as Test_grade for each student. Your program should read each student details from the file Then calculate the average of Quizzes and Tests marks Display the students’ details: Total number of students, total average, the total highest and lowest marks. The program should output the report into a file called output.txt. A sample of output text file is given below.Write a program that reads student data from a file, compute their GPA and writes the results to a different file. 1. The user should have the option to either enter their text file that contains the student grades or use the provided text file that contains theinformation. The data in "indata.txt" should look similar to this, Lara_Croft75 70 91 69 89Chris_Redfield68 88 79 85 94Johnny_Cochran69 98 95 77 80Wanda_Maximoff84 86 98 95 92Luke_Skywalker74 96 80 98 97William_Kurt89 52 99 81 58Samuel_Jackson50 96 50 64 95END_OF_FILE This is supposed to be in python. This is what I have so far. I have no experience I apologise. I am trying to finish the GPA calculating program currently but am having trouble finishing it. grade = input("enter grades")points = 0 if grade is 90-99:total_points = 4.0if grade is 80-89:total_points = 3.0if grade is 70-79:total_points = 2.0if grade is 60-69:total_points = 1.0if grade is 50-59:total_points = 0.0gpa = total_points/len(grade)print(gpa,"is gpa")Write a Python program for a simple quiz game. The questions and answers are stored in a text file named "questions.txt." Each line in the file represents a question and its corresponding options and correct answer in the format: "Question, Option1, Option2, Option3, Option4, CorrectOption." The program should load the questions from the file, present them to the user one by one, and keep track of their score. Allow the user to input their answer, and after completing the quiz, display their final score. Make sure to handle cases where "questions.txt" does not exist or has incorrect formatting. Use functions to structure your code, making it easier to understand and maintain. You can use a list or dictionary to store the questions and options. Ex: questions.txt: What is the capital of France?, Berlin, London, Paris, Madrid, 3 Who is the author of "To Kill a Mockingbird"?, Mark Twain, Harper Lee, J.K. Rowling, Ernest Hemingway, 2 What is the largest mammal on Earth?, Elephant, Blue…
- 6. Write a Python program that reads a text file called student.txt. The input text file contains student_ID, student_name, Quiz_grade as well as Test_grade for each student. output.txt: Your program should read each student details from the file Then calculate the average of Quizzes and Tests marks Display the students' details: Total number of students, total average, the total highest and lowest marks. The program should output the report into a file called output.txt. A sample of output text file is given below. student.txt: ID Name 20181867 Mohammed 20197541 Zakaria 20183245 Ahmed 20199876 Iqbal 20185432 Saem Class Report Quiz (40%) 90 91 79 66 30 There are total of 5 students The average of total marks is 71.48 Final (60%) 93 89 84 60 60 Mohammed scored the highest marks as 91.8% Saem scored the lowest marks as 48%urgent plzCreate a program that reads three lines from a text file. Each line should be read one at a time. For each word on a line, the user should be asked to specify how many syllables are in that word. The program should then inform the user if the file contains a valid Hiku using the function below: def isHiku (firstLine, secondLine, thirdLine):if (firstLine == 5 and secondLine == 7 and thirdLine == 5): return True return False print("The file contains a Hiku:", isHiku(5,7,5))Note: You must replace the values in the function with the numbers counted by your program.
- 6. Write a Python program that reads a text file called student.txt. ● ● The input text file contains student_ID, student_name, Quiz_grade as well as Test_grade for each student. output.txt: Your program should read each student details from the file Then calculate the average of Quizzes and Tests marks Display the students' details: Total number of students, total average, the total highest and lowest marks. The program should output the report into a file called output.txt. A sample of output text file is given below. student.txt: ID 20181867 20197541 20183245 20199876 20185432 20179807 Class Report Name Alia Shamma Zainab Noora Hamda Fatma Quiz (40%) 65 97 79 66 30 78 Test (60%) 50 90 84 75 55 82 There are total of 6 students The average of total marks is 71.267 Shamma (20197541) scored the lowest marks as 45 Hamda (20185432) scored the highest marks as 92.8In Python Write a program that consists of (at least) two function: A function that creates and saves data in a file. The saved data represents exam grades. In the function, you will create n random numbers in the range [0,100], where n is the number of students. The function can be called as follows: createFile(filename, n) Main function, in which the user inputs the file name and the number of students, then the main calls function createFile. The main should perform validation for n (should be > 0), and the filename (should end with .txt). I will explain how to validate strings in the coming lecture. Hint: a good developer will write four functions to solve the problem.Write a program, and store it in a file called Travel Expenses.xlsm, that does the following: (a) It asks for a person’s first name and stores it in firstName; (b) it asks for a person’s last name and stores it in lastName; (c) it asks for the number of miles the person traveled on a recent trip and stores it in nMiles; (d) it asks for the average miles per gallon the person got on the trip and stores it in milesPer- Gallon; (e) it asks for the average price per gallon paid for gas on the trip and stores it in avgPrice; (f) it calculates the cost of the trip and stores it in tripCost; and (g) it displays a message such as "Bob Jones traveled 800 miles, got 31.3 miles per gallon on average, paid $3.49 per gallon on average, and paid a total of $89.20 for gas." Make sure there is an Option Explicit line at the top of the module and that you declare all of your variables appropriately.