In Python please:
plagiarism: This Boolean function takes two filenames. If any line occurs in both files, return True. If not, return False. I suggest using nested loops. With nested loops, we call the loop that is in the body of the other loop, the "inner loop". The loop that contains the inner loop is the "outer loop". Open the second file inside the outer loop: for line1 in file1: file2 = open(fname2) for line2 in file2:
-----------------------------------------------------------------------------Pgm.py---------------------------------------------------------------------
file1=open("file1.txt", "r") # open file one in read mode # open file two in read mode
for line1 in file1:
file2 = open("file2.txt", "r")
x=0
for line2 in file2: # iterating lines from file two as inner loop
count = len(open("file2.txt").readlines()) #finding the length of the file
x+= 1;
line = line2
if line1==line2: # checking line from file 1 with all the lines with file 2
print("TRUE") # if any lines are similar true will be printed
break
else:
if count==x: # if the second file reaches last line and word from first file is not in second file print false
print("FALSE") # if none of lines from file 1 matched with file 2 false will be printed
file1.close()
file2.close()
--------------------------------------------------------------------------OUTPUT---------------------------------------------------------------------

---------------------------------------------------------------------------FILE1.TXT-----------------------------------------------------------------
ROAD
BALL
AIR
CAR
APPLE
PINE
---------------------------------------------------------------------------FILE2.TXT------------------------------------------------------------------
GYM
BALL
SALAD
CAR
APPLE
PINE
In Python please: plagiarism: This Boolean function takes two filenames. If any line occurs in both...
USE PYTHON PLEASE
Write a function called is prime which takes a single integer argument and returns a single Boolean value representing whether the given argument is prime (True) or not (False). After writing the function, test it by using a loop to print out all the prime numbers from 1-100. To check your results, the prime numbers from 1-100 are: 2, 3, 5, 7, 11. 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67,...
In python please
6 annoying_int_sequence(n) In annoying_recursion.py, write the function annoying_int_sequence(n) which takes a single integer parameter (which must be non-negative). It must return a list of intgers. The contents of the integers are defined recursively. Basically, each version of this sequence is made up of the next-smaller one, repeated n times - and with the number n in-between. For instance, the sequence for n = 3 is: ???? 3 ???? 3 ???? Just drop in the the sequence for...
CAN YOU PLEASE DO THIS IN JAVA! WILL LEAVE GOOD RATING THANK YOU Modify your program that reads grades from the user, so that it has a method that checks if a particular input is valid i.e. as long as the user types invalid input, the user should be given another chance to enter input (it would also be good to let the user know that their input is invalid). Moreover, only a valid grade should be used in computing...
The
both files are included. Where are these which are colorful.
Point.h and point.cpp
Hor this assignment you are provided the files for a class called point. Download the h and .cpp files and include them in your project. IheじML diagram below details the class Point くくfriend>> ostream& operator.((ostream&, point&) <ごfriend::. İstream& operator:..イ1stream&-point& - : double - v doublc getX) double getYO double - sctX( double): void - set Y(double) : void - point(double-0.0, double-0.0 operator-(const point& bool perator< const...
In this lab you will convert lab5.py to use object oriented
programming techniques. The createList and checkList functions in
lab5.py become methods of the MagicList class, and the main
function of lab6.py calls methods of the MagicList class to let the
user play the guessing game.
A. (4pts) Use IDLE to create a lab6.py. Change the 2 comment
lines at the top of lab6.py file:
First line: your full name
Second line: a short description of what the program...
please use python and provide run result, thank you!
click on pic to make it bigger
For this assignment you will have to investigate the use of the Python random library's random generator function, random.randrange(stop), randrange produces a random integer in the range of 0 to stop-1. You will need to import random at the top of your program. You can find this in the text or using the online resources given in the lectures A Slot Machine Simulation Understand...
Program 7 File Processing and Arrays (100 points) Overview: For this assignment, write a program that will process monthly sales data for a small company. The data will be used to calculate total sales for each month in a year. The monthly sales totals will be needed for later processing, so it will be stored in an array. Basic Logic for main() Note: all of the functions mentioned in this logic are described below. Declare an array of 12 float/doubles...
Roadmap To start, use the provided template file (on Blackboard): project_01_template.py. Replace the pass statements with your code. Notice that we included test cases under every function. If you run the project_01_template.py file at this point it should print False for each test. After you write the correct code for each function, and then run the file, it should print True for each test. 1. Write a function named gc_content that takes one argument sed and performs the following tasks:...