Write a python program that reads from a text file whose name is provided by the user and including lines relating to the dimensions of three kinds of shapes: Circle, Triangle, Trapezoid (see figure below for a sample input file). For each shape compute and display its area: - Triangle area = base X height. 2 A Cirale gren T radiuc2
Q: Write a Python program that solves the Towers of Hanoi puzzle. Your program should ask the user for…
A: Solution:-- 1)As given in the question it has required the solution with program in the Python…
Q: Write a program that coverts a zip code to a bar code. The bar codes use large and small bars. We…
A: Since no programming language is mentioned we will use Java to implement solution to this problem.…
Q: Write a python program that takes 2 inputs from the user. The first input is a string and the second…
A: Program: def removeChar(s, c) : counts = s.count(c) s = list(s) while counts…
Q: Write a Python program to create a Caesar encryption, user will input the message Note : In…
A: Program 1 : Step 1 : Start Step 2 : Define the encrypt_cypher() function , which takes the message…
Q: In python file operations, mode is used for reading the files Consider the value of x=86, y=54, a=86…
A: Python file Operation: -> The main function here is open() which takes the input parameters like…
Q: Write a Matlab program in a script file that finds and displays all the numbers between 700 and…
A: % initialize vector to store number whose digits sum=6product vect=[]; % initialize count count=0;…
Q: Write a program that will assign a suitable name to a given RGB triplet. Your names must be a hue…
A: # # Write a program that will assign a suitable name to a given RGB triplet. Your names must be a#…
Q: Write a python program that takes 2 inputs from the user. The first input is a string and the second…
A: The tested code for the first part is:
Q: Create a java program that search a specific word in text file. Also count how many times word…
A: PROGRAM: //Required header files import java.io.BufferedReader; import java.io.FileReader; import…
Q: Sites like Zillow get input about house prices from a database and provide nice summaries for…
A: Given requirement, Sites like Zillow get input about house prices from a database and provide nice…
Q: Write a shell script program that uses * to print the entire pyramid (shown below). To print the…
A:
Q: Write a Java program which reads a String composed of one or many words and prints out the number of…
A: import java.util.*;public class Main{ public static void main(String[] args) { String s; int…
Q: Create a program that asks a character input. If the character input is 'Y', then it prints…
A: Below I have provided a Java program for the given question. Also, I have attached a screenshot of…
Q: Create a program which the final grade is calculated from an input like the image. So with use of…
A: According to the information given:- We have to calculate the average grade from where the final…
Q: 1. Create a file with given numbers. Read them from file with a python program and calculate mean,…
A: Task : Load the data Find and plot mean variance standard deviation
Q: Write a Python program to read an integer value p and calculate the following mathematical series.…
A: function main: Start read p initialize sm = 0 for m in range(1,11) follow step 5 sm = sm +…
Q: write a python program to Create a variable containing the DNA sequence: ACGCAGAATGCTTAGGACTAGTTAC…
A: Start Declare a variable dna and initialize value Replace T with U and store it as rna Print middle…
Q: Write a Java program which reads a text file and prints the total number of lines, number of words…
A: import java.util.*;import java.io.*;class Test158 { public static void main(String args[]) throws…
Q: Write a python program that Take a lowercase word as an input from the user. Modify the word in such…
A: According to the question, here is your answer
Q: In Python, write an improved version of the chaos.py program that allows a user to input 2 initial…
A: print("Tis program illustrates a chaotic funstion") x=eval(input("Enter a first number between 1 and…
Q: Write a program that displays five texts vertically, as shown inFigure a. Set a random color and…
A: The JAVA program to display five texts vertically according to the given figure is given below.
Q: A scanner in the department stores reads in the following string (simulate with file input)…
A: Actually, the code has given below:
Q: I want a coding in python 3 on raspberry pi that can find a video in a file and tell me the time…
A: A 2-part series on motion detection This is the first post in a two part series on building a motion…
Q: Write a java program that read a line of input as a string and prints only the uppercase letters in…
A: Given: Write a java program that read a line of input as a string and prints only the uppercase…
Q: Write a Python program that takes a positive integer from the user and prints the number of digits…
A: Python Program for the above problem
Q: using java language Scanners are handy for reading input that is stored in a file. For this…
A: The below given Java program will obey the following rubrics: Including necessary data packages. In…
Q: Save your program that lead to the answer in a python file (NameMatricNoQ1.py You need to insert…
A: Python used to answer this question
Q: Write a python program that converts a Decimal Integer number to a Binary Number. "A decimal can be…
A: code: #define the method def decBin(val): #condition to compare the value if val…
Q: Write a python program that accepts any 10 integers and do the following a) calculate sum of only…
A: take 10 inputs in array from user use % (mod) operator to check each element is even or not. i.e…
Q: Write a Python program that takes a number and tells if it is a perfect number or not. [The input…
A: Write a program that takes a number and tells if it is perfect number or not.
Q: Write a program that displays the classic BINGO game, displays a BINGO card (5x5 square), and tests…
A: Given data is shown below: Write a program that displays the classic BINGO game, displays a BINGO…
Q: Write a Java program that uses the coordinates.txt file in your project directory. Each line of this…
A: Hey there, I am writing the required solution for the above stated question.
Q: Write a Program in java to print a string and then don't end the compiling till it get 'Q' Or q…
A: Requirements:- Write a Program in java to print a string and then don't end the compiling till it…
Q: Write a Python program that takes a word as an input from the user and does the following. While…
A: Coded using Python 3.
Q: Write a program that coverts a zip code to a bar code. The bar codes use large and small bars. We…
A: Solution:#Define the functiondef checksum(zip): #Declare the empty variable sum = 0 #Loop…
Q: Q2. Write a python program to fetch only Email ID from text file which include following fields -:…
A: A python script for extracting email addresses from text files
Q: Write a program in Python using the OpenCV library that: A) Gets the name of a color image from the…
A: Answer: I have done code and also I have attached code as well as code screenshot.
Q: Write a MATLAB program in a script file that finds a positive integer n such that the sum of all the…
A: Use an infinite loop to find the sum and keep on adding the Integer to Sum till the Sum is 3 digit…
Q: Task 7 Write a python program that takes 2 inputs from the user, where the first input is a string…
A: The slice syntax can be used to return a range of characters. To return a part of the string,…
Q: Write a Java program that outputs your name, today's date, and five lines of your favorite G-rated…
A: PROGRAM: //Header file import java.io.File; import java.io.PrintWriter; import…
Q: Create a file with given numbers. Read them from file with a python program and calculate mean,…
A: Answer is given below-
Q: Write a python program: In the first century AD, Nicomachus suggested in his book entitled…
A: Take a variable to input a number from the user. Take a variable to store the required odd numbers.…
Q: Write a python program that takes 2 inputs from the user. The first input is a string and the second…
A: Given: Write a python program that takes 2 inputs from the user. The first input is a string and the…
Q: Write a program in python that reads a number and prints all of its binary digits: Print the…
A: Python Program: def DToB(n): if n >= 1: DToB(n // 2) print(n % 2, end=' ')n =…
Q: Write a Python program that will ask the user to input a word, will return the first letter of the…
A: Given: Write a Python program that will ask the user to input a word, will return the first letter…
Q: Write a program in Python whose input is two integers. Output the first integer and subsequent…
A: EXPLANATION: - The user input is read by using the input function which is of type string. The…
Q: Write a program that transforms the user input stream: (1st) A B C A B C A B C (last) into the…
A: Here our task is to transform user input to the given format. User input will be a string, if we are…
Q: Write a python program which creates and outputs variables of various types. For any lines of code…
A: Program: #Creating variablesa=24b=9.24c="24'42'"d='42"24"'e='''34"43"'''f="""62'26'""" #output the…
Q: Write a Java program that reads an integer numbers X, while Y and W both are float. Then find Z…
A: The required Java program code is given below: import java.util.*;import java.lang.Math;class…
Q: Write a python program named Weather that is passed a dictionary of daily temperatures , and returns…
A: By using dictionary have to find average temperature in weekend.
Use files( handling exception)
Step by step
Solved in 2 steps with 3 images
- Exercise 5: Write a python program that reads from a text file whose name is provided by the user (see a sample below) blood glucose readings recorded during the last week. Each line contains a certain number of blood glucose readings followed by the patient id. Your program should then display for each patient, their id number, the number of readings, the average value of the readings followed by the patient status (Normal range: 90–120 mg/dl, Low range: less than 90 mg/dl, High otherwise). Your program should consider the following erroneous cases and display appropriate message as shown in the sample output below: • The file does not open/exist • The readings are invalid (non-integer values or negative) or missing, in which case a ValueError exception should be raised and the processing should continue. Enter input filename: patients.txt Patient Id #Readings Average Status ========== ========= ======= ====== 120 150 150 P1111 P1111 3 140 High 100 90 90 100 P2222 P2222 4 95 Normal…In C language, create a program that uses a standardized input method (input file with From To and Weight defined) to read in a text file. The text file will contain the name of the building and the distance from each building when running the program with the file, the program will read the information above and will ask users which buildings are they in and where they want to go to find the shortest path. then it will display the shortest route and the distance from the building that the user is at to the building that the user wants to go toExercise 1: Write a python program that reads from a text file whose name is provided by the user and including lines relating to the dimensions of three kinds of shapes: Circle, Triangle, Trapezoid (see figure below for a sample input file). For each shape compute and display its area: - Triangle area = base X height. - Circle area =n radius². - Trapezoid area = (base 1 + base,)X height. Your program should consider the following erroneous cases: • The file does not open/exist • The format of the data in the file is incorrect (e.g. shape name = 'Polygon’), the shape's dimensions are incorrect (e.g. negative value or number of values for a trapezoid not equal to 3: base,, base, and height, or), in which case RuntimeError exception should be raised and the processing should continue. Triangle: 50 48 Shape Area Circle: -10 Triangle Circle Trapezoid: 10 12 70 1200.00 >> invalid dimension 770.00 Trapezoid: 9 32 Trapezoid Trapezoid >> missing data. Sample input file Sample output
- A company stores payment information for their employee working on a project and paid on a project basis, in a text file whose name is entered through keyboard (see a sample input file below). The first line of the file indicates the number of employees and each subsequent line corresponds to information related to an employce payment (employee name, number of hours worked and his/her hourly wage). Write a python program that reads such a file and displays the employees' names, their hours worked, and their salaries. Finally, it displays the total Your program should consider the following erroncous cases: рaуmеnt. • The file does not open/exist The format of the data in the file is incorrect (e.g. hours = "1-" or salary = "unkown") in which case a RuntimeError exception should be raised and the processing should continue Enter input filename: employees.txt Employee Hours Salary Badria Al-Harthi: 11 Youcef Al-Busaidi: 19 720 Salim Al-Hajri: Majid Al-Sinani: Amer Al-Shidani: 10 unkown.…A python function opens file data.csv, reads the data from the file and spits the data into three columns, x, y and z. The data is then printed out. Function: f = open("data.csv ", "r") print('x\ty\tz'.format()) for row in f: temp = row.split(',') for cell in temp: print(cell,end='\t') print() data.csv contains: 1.2,2.1,1.1 2.3,3.2,0.6 0.7,1.9,0.1 1.8,2.5,0.3 4.6,2.7,0.9Code should be in Python. Given a text file containing the availability of food items, write a program that reads the information from the text file and outputs the available food items. The program first reads the name of the text file from the user. The program then reads the text file, stores the information into four separate lists, and outputs the available food items in the following format: name (category) -- description Assume the text file contains the category, name, description, and availability of at least one food item, separated by a tab character ('\t'). (Examples in image)
- 12 Digit Barcode In this homework, you will develop a python program which reads a series of barcodes from "barcodes.txt" and creates an output file "output.txt" which contains the barcodes and their status as seen in the example output below. 153182953420 5+1+2.5.4-1 7+3+8+4+3+2-3 1 23601057072 6+t-13 Even : 2+6+1 +5+0 = 14 Odd: 1+3+0+ 0 +7+7 = 18 3 x8 = 24 D+3- 10 4 + 4 = 8 10 -8 = 2 (CORRECT) What to submit: 1) ipynb file which contains checkBarcode function which takes a string varlable as input and returns true or false, and a driver program which reads in "barcodes.txt" and creates "output.txt". Assume the input file contains one barcode info per line. Important: Your input file name MUST BE "barcodes.txt" and the output file name MUST BE "output.txt". Otherwise, you'l get up to 30 pts penalty Below a sample output.txt: 123601057072 is a valid 10-digits barcode lab601057072 is an invalid 10-digits barcode 172601055072 is an invalid 10-digits barcode 12345 is an invalid 10-digits…Problem Definition Task. Your task is to develop a python program that reads input from text file and finds if the alphanumeric sequence in each line of the provided input file is valid for Omani car license plate. The rules for valid sequences for car plates in Oman are as follows: Each sequence is composed of 1 to 5 digits followed by one or two letters. Digits cannot start with 0, for instance, 00, 011, or 09 are not valid digit sequences. The following list are the only valid letter combinations: ['A','AA','AB','AD','AR','AM','AW",'AY"', 'B', BA','BB','BD',"BR','BM',"BW',"BY', 'D','DA','DD','DR','DW','DY', 'R','RA','RR','RM','RW','RY', 'S','SS', 'M','MA','MB','MM','MW','MY", "W',"WA',WB',"wW', Y,YA','YB','YD','YR','YW',YY] Program Input/Output. Your program should read input from a file named plates.txt and write lines with valid sequences to a file named valid.txt. Any line from the input file containing invalid sequence should be written to a file named invalid.txt. Each line…The file “dna.seq” (on Blackboard) consists of several DNA sequences. Write a program that reads in the file “dna.seq” and counts the number of sequences with the following properties:• The total number of sequences in the file• The number of sequences that have the pattern CTATA• The number of sequences that have more than 1000 bases• The number of sequences that have over 50% GC composition• The number of sequences that have more than 2000 bases and more than 50% GCcompositionUse python
- The file "dna.seq" (on Blackboard) consists of several DNA sequences. Write a program that reads in the file "dna.seq” and counts the number of sequences with the following properties: • The total number of sequences in the file • The number of sequences that have the pattern CTATA • The number of sequences that have more than 1000 bases • The number of sequences that have over 50% GC composition • The number of sequences that have more than 2000 bases and more than 50% GC composition Some program requirements: (1) the program should prompt the user for the filename. (2) each of the above tasks should be its own function. dna seg file = CAAAGATTAAGCCATGCATGTCTAAGTATAAGCAATTATACCGCGAAACTGCGAATGGOTCATTAAATCACT TATCGTTTATTTGATAGTACCTTACTACATGGATAACCGTGGTAATTCTAGAGOTAATACATGOTAAAAAGO CCGACTCACGGAGGGTTGTATTTATTAGATTAAAAAThe file “dna.seq” (on Blackboard) consists of several DNA sequences. Write a program that reads in the file “dna.seq” and counts the number of sequences with the following properties:• The total number of sequences in the file• The number of sequences that have the pattern CTATA• The number of sequences that have more than 1000 bases• The number of sequences that have over 50% GC composition• The number of sequences that have more than 2000 bases and more than 50% GCcompositionLanguage: Java 1. The sample input will have to be in Text File (.TXT) 2. By using the first function, this program reads score and name values from a file. The program then determines the grade for each students by using the second function. Finally, the program displays the name, score, and grade information on the console. The two functions are shown in the images attached below: