In python
Simply write the Euclid algorithm in a form that takes two numbers from input and prints the gcd. The code does not need to check for valid input. It must work for any pair of positive integers. Create a separate program that uses the python timeit module to provide test run-times for your code. Provide at-least 5 sample runs. Create a third file that implements another algorithm to find the gcd. Provide a program that uses the timeit module to provide sample run-times for this one as well.
Create a Microsoft word document that provides screen captures of running your two algorithms with your commentary of the results and your code. At the END of the document, include your code from your 4 python modules in TEXT format, NOT screen capture.
CODE 1
def eucledianGcd(a, b):
if a == 0 :
return b
return eucledianGcd(b%a, a)
CODE 2)
import random
import time
for i in range(5):
a = random.randint(10, 200)
b = random.randint(10, 200)
start_time = time.time()
gcd = eucledianGcd(a, b)
end_time = time.time()
print("Run %d of Eucledian GCD took %s seconds " % (i+1, time.time() - start_time))

CODE 3)
def GCD(a,b):
if (a == 0):
return b
if (b == 0):
return a
if (a == b):
return a
if (a > b):
return GCD(a-b, b)
return GCD(a, b-a)
CODE 4)
import random
import time
for i in range(5):
a = random.randint(10, 200)
b = random.randint(10, 200)
start_time = time.time()
gcd = GCD(a, b)
end_time = time.time()
print("Run %d of Normal GCD took %s seconds " % (i+1, time.time() - start_time))

In python Simply write the Euclid algorithm in a form that takes two numbers from input...
In python Programming Exercise 1 Write a function that will have a list as an input, the task of the function is to check if all the elements in the list are unique,( i.e. no repetition of any value has occurred in the list), then the function returns true otherwise it returns false. Your program should include a main method that call the method to test it. Algorithm Analysis For the function you implemented in part 1, please calculate T(n),...
Appreciate a step by step explanation to this question.
Write two separate programs in python that generate the n-th Fibonacci number. The programs should both take n as command line input. The first algorithm one should implement the recursive algorithm, and the second one should implement the iterative algorithm. Measure the time it takes for each of these versions (use for example, the time it module in python) to calculate the n-th Fibonacci number for the following values of n:...
PYTHON Programming Exercise 2: Create a Simple Cost Calculator Write a program that displays input fields (item name and cost) and calculates and displays the calculated costs. The program should do the following: Provide data entry areas for item name and cost. Calculate and display the subtotal of all items. Adds a sales tax of 6% and calculate and displays the total cost. Enter the following values into your program. Mother Board $200. RAM $75. Hard Drive $72. Video Graphics...
3. Write Python statements that will do the following: a) Input a string from the user. *** Print meaningful messages along with your output.* b) Print the length of the String. Example input: The sky is blue. Correct output: The length of the string is 16 Incorrect output: 16 c) Print the first character of the string. d) Print the last character of the string. 4. Save the program. Double-check the left edge for syntax errors or warning symbols before...
python code:
Task 1: Write a Python program that takes as input from the user the name of a file containing postcode/location information. Each line in the file consists of the postcode followed by a tab followed by a comma-separated list of locations that have that postcode. For example, the file Small.txt contains: 3015 Newport,South Kingsville,Spotswood 3016 Williamstown 3018 Altona,Seaholme 3019 3021 Albanvale,Kealba,Kings Park,St Albans Braybrook, Robinson Your program should create a list of postcode/location pairs with each pair stored...
PLEASE DO BOTH OF THESE IN PYTHON!!! AND MAKE SURE THAT I CAN COPY THE CODE. 1.) Exercise #1: Design and implement a program (name it PrintSum) that prompts the user for an integer values between 1 and 100. The program then uses a while loop to determine and print out the sum of all values between 1 and the entered value. The program rejects invalid input values with proper message such “Invalid Input. Try again.” Document your code and...
I need some help with programming this assignment.
Programming Assignment 6: A Python Class, Attributes, Methods, and Objects Obiectives .Be able to write a Python class Be able to define class attributes Be able to define class methods .Be able to process input from a text file .Be able to write an application using objects The goal of this programming assignment is to develop a simple image processing application. The application will import a class that creates image objects with...
This needs to be written in Python. I'm writing this but I'd love to see how others would do it. I have idea to make a program to keep track of reading. Set goal per day. Input minutes per day & book read. Could accumulate for whole month. Input daily, but you can input it all at the end of the week if you want. I want the user to be prompted to enter a numerical value and book for...
I am writing a Python program to serve as a fitness tracker. I would love some input as to how you would code this. I've included what I want this program to accomplish, what I will keep track of, and below all of that I have posted the assignment guidelines. Any suggestions on how to make this better/ more efficient would be welcome! I'm thinking of making a weekly tracker that takes input per day, and outputs at the end...
• Next to these lines, write functional Java codes that will: (1) ask user to input a positive integer, such as 15; (2) create a void type of method named "findSum" that takes a parameter of int type named "n". Make sure the "findSum" method can calculate the sum of 1+2+3+ ... +n; and (3) use the "System.out.println(" to display the newly calculated sum. The following is a sample output: Enter an integer: 15 120 Enter an integer: 10 Enetr...