how to write a function in python 3 that reads a txt file which includes three number (each line has one number) assuming these numbers are the side lengths of a triangle. The function checks the validity of the triangle and prints whether the triangle is valid or not. If is is valid, the result should also indicate the type of triangle.
Q: Write a C++ program that computes the area A of Cone by reading its parameter from a text file…
A: I have given an answer in step 2.
Q: Write a complete C program that inputs marks of a student in 5 courses using any loop and writes…
A: Required:
Q: Write a program to calculate the net pay of an employee. Input the basic pay, pass basic pay to user…
A: #include<iostream.h>#include<conio.h> class Employee{ char emp_name[30]; int…
Q: Write a complete C program that inputs marks of a student in 5 courses using any loop and writes…
A: Algorithm : main function Step 1 : declaring required variables and array. Step 2 : using a for loop…
Q: I need help in creating a C function that will read a specific line from a text file in C based on…
A: Use fgets c function to get the string. first find out the line number and point file pointer to it.…
Q: 2. Write a complete C program that inputs marks of a student in 5 courses using any loop and writes…
A: The method of designing and developing a computer program that is executable to achieve a particular…
Q: Write a program in c++ to calculate the net pay of an employee. Input the basic pay, pass basic pay…
A: C++ code: #include <iostream>#include <fstream>#include <string.h>using namespace…
Q: Write a function that accepts two strings of equal length and returns a strings where the characters…
A: Aim: To write a function that accepts two strings of equal length and returns a string where the…
Q: Write a complete C++ program in one file which takes a double value from the user, cubes it, and…
A: Program plan: - To create a C++ program that takes a double value from the user and calculates the…
Q: in c++ : Write a function to count number of words in a text file named "story.txt".
A: Code: #include <iostream>#include <fstream> using namespace std; int main() { string…
Q: Write a C++ function which receive two files as parameter and display its common words. Write helper…
A: ifstream firstFile("c:/a.txt"),secondFile("c:/b.txt"); string fFileStr,sFileStr;…
Q: In Python Define a function writeScores with two parameters. The first should be the name of a file,…
A: Following is the python program which defines a function writeScores having two parameters file and…
Q: Write a function find_decrypted_words() that takes a file name as parameter, reads that text file…
A: Given:
Q: Write a Python program that calculates the average 5 quiz scores from a file with student ID and…
A: Note: Both txt files and .py files should be saved in Desktop. i consider only 5 quizes but the…
Q: Write a program that creates a function to read multiple DNA sequences from the user and writes them…
A: Code: # Python program to convert# altered DNA to protein inputfile ="DNA_sequence_original.txt" f…
Q: Write a C++ program that computes student grades for an assignment as a percentage given each…
A: the program ia an given below :
Q: 2. Write a complete C program that inputs marks of a student in 5 courses using any loop and writes…
A: The code is given below
Q: Python: Character Histogram
A: Summary: In this question, we have been one program and we have to write the code in python. In…
Q: Write a program to calculate the net pay of an employee, Input the basic pay, pass basic pay to user…
A: Objective: A program is built to insert the information about employees and calculate the net pay by…
Q: Need help in creating a C(NOT C+ OR C#) function that will help split a string present in a Text…
A: #include <stdio.h>#include <string.h> int main(){ char word[30]; FILE *fp;…
Q: You are given a file consisting of students’ names in the following form: lastName, firstName…
A: stud.cpp #include<iostream>#include<fstream>#include<string>using namespace std;…
Q: Write a Python program that calculates the average 5 quiz scores from a file with student ID and…
A: Note: Both txt files and .py files should be saved in Desktop. i consider only 5 quizes but the…
Q: I need help in creating a C function that will read a specific line from a text file in C based on…
A: In this question we have to write a C program in which we have to use the file method to read file…
Q: Write a complete C++ program in one file which takes a double value from the user, cubes it, and…
A: Following is the c++ program:Approach: declare necessary header files. declare global variable c…
Q: Write a function named framestr that takes as input a string s, and PRINTS on the screen a framed…
A: len(s) find length of string s '-' * n '-' copy it n times if n=5 '-'*n = '-'*5 = '-----'
Q: Please answer it in Python Below are the first 4 lines of such a file whose number of lines is not…
A: Hey there, I am writing the required solution of the above stated question.Please do find the…
Q: Write a c++ program that takes a date in the following format: December 24th, 2021 and extracts the…
A: Actually, program is an executable software that runs on a computer.
Q: Write a function that reads a single line "question1.txt", and returns the average the file is as…
A: Begin by creating a text file and storing numbers in it. I have named my file question1.txt.…
Q: Write a Python function that creates a csv file that includes a price list of user-entered items.…
A: In this programming question we have to execute a program in python This program we have to write to…
Q: 2. Write a complete C program that inputs marks of a student in 5 courses using any loop and writes…
A: Given: Write a c program to store the values of 5 courses into file and read the values from file…
Q: Write a c++ function that reads from a file the name and the weight of each person in pounds and…
A: Function poundtokg() For convert pound to kilogram. The values read from file. step1: Open the file…
Q: Write a function reverse_file(f) that takes a file name f. After your function runs, the lines in f…
A: file can be opened by specifying the file location and mode of operation
Q: a) Write a python program that reads the data file class-a.csv into a data frame and displays 3 rows…
A: Part A: import pandas as pd data = pd.read_csv("class-a.csv") data.head(3)# first 3 student detail
Q: Write a program in C++ that finds the count of a number in a list of integers from a text file named…
A: Here is the c++ code: See below step for code.
Q: The file text.txt contains a sentence text written in all small letters and does not have any…
A: import java.io.*; import java.util.*; // We have a class named Main public class Main { // We…
Q: Write a function getQuestions that accepts a single parameter: filename, which is the name of a txt…
A: Note : As you have not mentioned any language for programming but the description clearly shows that…
Q: python Write a function that reads in a text file, and counts the number of times each word occursin…
A: The program first creates a file sample.txt and stores a string in it. Then it reads the created…
Q: Write a C++ function that meets the following specification. Name: wordFinder Inputs: 1) input…
A: NOTE: - Since the file is not given, hence a sample file is taken to implement the required C++…
Q: P5. Write a Python function named interleaveChars that is given two lines read from a text file, and…
A: def interleaveChars(line1,line2): #find number of char in line1 and lin2 n=len(line1)…
Q: In C, I need help in creating a function that will randomly select a line between 1 till 50 and then…
A:
Q: 1. Write a function in python to count the number of lines from a text file "story.txt" which is not…
A: Explanation: Given data write a python program to count the number of lines from a text file…
Q: 2. Write a complete C program that inputs marks of a student in 5 courses using any loop and writes…
A: Answer:- Source code #include<stdio.h>char computeGrade(double);int main(){ //create a…
Q: Implement a function wordCount, which reads a text file, and returns the number of words in the…
A: since you haven't mentioned the programming language, we are answering this in c. Program code:…
Q: Write a function (in a file called convert_knots.cpp) that converts knots into miles per minute. The…
A: The program is written in C++. Check the program screenshot for the correct indentation. Please…
Q: pandas DataFrame, col
A: Given as, def calc_mean_mode(df, column_name): # your code here return calc_mean_mode(df,'Age')…
Q: Write a program in C Write two functions product1()andproduct2( )that can multiply two integers and…
A: EXPLANATION: - The header file stdlib needs to be included to work with files. The product1…
Q: 2. Write a complete C program that inputs marks of a student in 5 courses using any loop and writes…
A: Create a function for calculating marks. Using if-else-if to determine the grade as per the marks.…
Q: Write a function charHistogram(filename: str) -> None that takes the file name of a text file and…
A: It is defined as a frequency distribution shows how often each different value in a set of data…
how to write a function in python 3 that reads a txt file which includes three number (each line has one number) assuming these numbers are the side lengths of a triangle. The function checks the validity of the triangle and prints whether the triangle is valid or not. If is is valid, the result should also indicate the type of triangle.
Step by step
Solved in 4 steps with 1 images
- (5) Write a function called copy_even_lines() that takes two strings (filenames) as input parameters and copies every other line from the first file into the second. That is, counting from 0, it copies the 0th line, the 2nd line, the 4th line, etc. from the first file to the second file. You may assume that both files exist. (6) Write a python program that asks the user for two filenames and calls your function copy_even_lines() from (5) using those two filenames. If one or more files do not exist, your program must handle the exception by repeating the prompts until valid filenames are entered.Write a C program that contains two functions: one that calculates the counts from standard input, and another that calculates the counts from a string. This file should counts the number of letters, digits, other characters, and total characters from the input.If the user does not provide any additional command line arguments, count the occurrences from standard input. If there is an additional command line argument, count the occurrences in the string provided on the command line.python Write a function that reads in a text file, and counts the number of times each word occursin the file. Then print the words alphabetically with its corresponding count. Each word willbe separated by a space or newline, but there is no guarantee that each word will be on aseparate line.
- a) Write a python program that reads the data file class-a.csv into a data frame and displays 3 rows of those data. Please import the suitable library.b) Write a function which receives the data frame from (a) to calculate the BMI and return the BMI data. Include the function call. Height data is in meter and Weight data is in kg. The formula for BMI as follows:BMI = weight / height2c) Display the BMI data in sequence and calculate the mean of BMI. If the mean of BMI is exceeded 25 then display “Students are overweight”.d) Plot the pie chart for BMI distribution with student’s name as a label. Please import the suitable library.Write a function in python that takes an acrostic as the input and will return the secret message to the user. Include optional arguments to state what makes the first line, as well as what position should be used.a) SATOR\nAREPO\nTENET\nOPERA\nROTAS\n1. Use each index position 0 through 4 b)Elizabeth it is in vain you say\t“Love not” – thou sayest it in so sweet a way:\tIn vain those words from thee or L.E.L.\tZantippe’s talents had enforced so well:Ah! If that language from thy heart arise,\tEndymion, recollect, when Luna tried\tTo cure his love – was cured of all beside\tHis folly – pride – and passion – for he died.“An Acrostic” by Edgar Allen PoeWrite a complete C program that inputs marks of a student in 5 courses using any loop and writes these marks into an output file named txt. After that, it reads scores from myElements.txt and computes the grades based on the table below using a programmer-defined function char computeGrade(double score), and displays the grades on screen. Score Grade >= 90 A 80-89 B 70-79 C 60-69 D <= 59 F ----- please, write 1. the c program code 2. include comments on your code 3. contents of the file myElements.txt 4. sample output Thank you so much
- I need help in creating a C function that will read a specific line from a text file in C based on the randomly generated number ranging from 1 to 50(have to use rand() ). The function would have the parameter of the text file and would return the string that the specific line of the text file contains. Restrictions : Cant use break, exit(), break , continue,global variables. Only allowed to use stdio.h and string.h For instance if the random number is 4 then the function would return the 4th line of the particular text file.In Python Define a function writeScores with two parameters. The first should be the name of a file, and the second should be a list of integer scores. The set of scores should be appended to the given file, one score per line.Create a function called oddLessEven that takes a positive integer input and returns the sum of the odd and even digits subtracted. For instance, the oddLessEven software. (Submit a single C++ file including your oddLessEven function and the main function.) main() int cout oddLesseven(23) endl; // prints 1; // prints -2; // prints 21 return 0; cout oddLessEven(777); // prints 23;
- Write a standalone function partyVolume() in Python that takes accepts one argument, a string containing the name of a file. The objective of the function is to determine the a Volume object that is the result of many people at a party turning the Volume up and down. More specifically: the first line of the file is a number that indicates the initial value of a Volume The remaining lines consist of a single character followed by a space followed by a number. The character will be one of ‘U” or ‘D’ which stand for “up” and “down” respectively. The function will create a new Volume object and then process each line of the file by calling the appropriate method of the Volume object which changes the value of the Volume. The function then returns the final Volume object. Guidelines/hints: This is a standalone function, it should NOT be inside (indented within) the class. It should be listed in the module after the Volume class and without indentation. Note that the first line of the…Write a program in C Write two functions product1()andproduct2( )that can multiply two integers and return the result. Function product1()takes only two parameters (n1)and (n2)which are both input parameters. The second function product2( )takes an output parameter (p)in addition to those two input parameters.Write a program that opens a text file "integers.txt" to read two integers and calls the two functions product1( )and product2( )to test that they are working properly.Write a function called max_age(inFile, outFile, breed) for a (python program), that takes three strings as input parameters. The function reads all the data from the inFile (1st input parameter) and writes data to the outFile (2nd input parameter) as described below. Each line in the input file represents a pet record and has the following format. name, breed, age where name and breed are strings, and age is an integer value. Your function must find the oldest pet of a given breed (3rd input parameter) from the inFile and write the following information to the outFile. breed, total records of this breed name of the oldest pet, age of the oldest pet Note that outFile must only have these two lines of information. Suppose, inFile contains the following data: shadow, longhair, 3 poshi, bangal, 5 mikus, longhair, 4 tigger, calico, 9 If you call this function with breed = "longhair", then the following must be written in the outFile: longhair, 2 mikus, 4 Your…