Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

I am doing a beginner Python programming course and this is my final assignment. I HAVE ONLY ATTACHED THE ASSIGNMENT PAPER but in order to do the exercises i have a total of 11 other text files. The...

1 answer below »
I am doing a beginner Python programming course and this is my final assignment. I HAVE ONLY ATTACHED THE ASSIGNMENT PAPER but in order to do the exercises i have a total of 11 other text files. The support (John) told me that I can send these to you with the email ID afterwards because I was only allowed to attach 5 files here. N.B. Since I am doing a beginners course(started 6months ago), the programming does not have to be very complex. The topics we discussed in class were: Data types, Loops, Conditionals, Functions, Files, Tuples, Modules, Programmer-defined types
The exercises should be possible to be answered with these topics. If you have any other question then let me know please.
Answered 6 days After Jan 07, 2021

Solution

Swapnil answered on Jan 14 2021
153 Votes
# Q3--------------------------------------------------------------------------
def FirstAndLast(string):
for i in range(len(string)):
if i == 0:
print(string[i], end = "")
if i == len(string) - 1:
print(string[i], end = "")
if string[i] == " ":
print(string[i - 1],
string[i + 1], end = "")
if __name__ == "__main__":
string = "words strings sand direct tool like etce"
FirstAndLast(string)
# Q4 ---------------------------------------------------------------------------
def pythagoreanTriplets(limits) :
c, m = 0, 2
while c < limits :
for n in range(1, m) :
a = m * m - n * n
b = 2 * m * n
c = m * m + n * n
if c > limits :

eak
print(a, b, c)
m = m + 1
if __name__ == '__main__' :
limit = 20
pythagoreanTriplets(limit)
# Q5--------------------------------------------------------------------------------------
import sys
def maxLines(n, x1, y1, x2, y2):
s = [];
slope=sys.maxsize;
for i in range(n):
if (x1[i] == x2[i]):
slope = sys.maxsize;
else:
slope = (y2[i] - y1[i]) * 1.0 /(x2[i] - x1[i]) * 1.0;
s.append(slope);
return len(s);
n = 2;
x1 = [ 1, 2 ];
y1 = [1, 2];
x2 = [2, 4];
y2 = [2, 10];
print(maxLines(n, x1, y1, x2, y2));...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here