Commit fefe20b5 by videid

work

parents
import matplotlib.pyplot as plt
class homework(object):
print("enter A value")
A = float(input())
print("enter M value")
M = float(input())
print("enter H value")
H = float(input())
values = []
returnvalues = []
i=0
def f(x) : return (2+x)*(x+(1/x))/(x*x*(1/(1+x*x)))
if H <= 0:
print("wrong H value")
else:
while f(A + i*H) < M and i < 14:
V = f(A + i*H)
if V != float("inf") or V != float("-inf") or not isinstance(V,float) :
returnvalues.append(V)
values.append(A + i*H)
i = i+1
else:
print("not available")
i = i+1
print(returnvalues)
plt.plot(values,returnvalues)
plt.show()
i didn't really understand what "algorithm given by us meant so i just filled a random algorithm that matched the criterias.
\ No newline at end of file
<mxfile userAgent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36" type="device" version="7.5.3" editor="www.draw.io"><diagram name="Page-1" id="dd4fdf45-0a81-a461-4935-abd9e4a15d39">3VlLk6M2EP41PmbLIMD2cey1N4c8tsqHZI4yaEBZgSghv/bXp4XEUzDjnWGdlLkYtURL/fXXrZY8Q5v08kXgPPmdR4TN3Hl0maHPM9d1PDeAHyW5asnCX2pBLGhkBjWCPf1OjHBupEcakaIzUHLOJM27wpBnGQllR4aF4OfusBfOurPmOCaWYB9iZkv/opFMjNQJVk3Hr4TGiZl6WRl8wOG3WPBjZuabueilfHR3iitdxtAiwRE/t0RoO0MbwbnUb+llQ5jCtoJNf7cb6a3XLUgmb/nA1R+cMDsa0xnOJc+VEn4molxzBtamSqFesrxWMBVnmjKcQWt9Tqgk+xyHqusMrLBXYhZ3IkKSS0tkVvaF8JRIcYUhphctDUqGRZ5pnhuXoIoxScsbiwpdbGgQ16obKODFoDGMjG8hY5kPHwAhlfXgxlwJC4mF3EsslfCFMrbhjItyNJqXjxosBf9Gqp6Ml/jZcLk/CpczfxuuAbTQBGAFN4AVQYSZJmEHft42gnUpgI6EC/qdZxLDRGtlOYWYfGI0zqDzwKXkqRqdRU8qyEHGc5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(KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36" type="device" version="7.5.3" editor="www.draw.io"><diagram name="Page-1" id="dd4fdf45-0a81-a461-4935-abd9e4a15d39">5Vtbb+MoFP41fh0Z3/3Y9DIjzexF6kq7faQxcdzBJotJk+6vX7CxYweSqaaGpp5IrewDBnz4+M4F7PjX5f4zhZv1byRD2PHcbO/4N47nJSDk/4XgpRUEEWgFOS2yVjQQ3Bf/ISl0pXRbZKgeVWSEYFZsxsIlqSq0ZCMZpJTsxtVWBI973cAcKYL7JcSq9O8iY2spBVF6KPiCinwtu068qC14hMvvOSXbSvbneP6q+bXFJezaki9ar2FGdgORf+v415QQ1l6V+2uEhWo7tbXP3Z0o7cdNUcVe84DfPvAM8Va++l9X91+5pHKuPWfhJnKY7KVTTb0rSgwrfrfYrQuG7jdwKYp2HAhcVjNKvqNrggnlwoo0FVcFxkeirplvhbi9cblIHbt8nWdEGdoPRPJdPiNSIkZfeBVZ6ncA2h1mLfIkGNeDCQNRVxNKqOR9Ywd18QupMb32gkBRD8o4kOQtoWxNclJBfHuQLhp0oEy+9JqVvPUbwC/RvmD/CPGnUN49dCUVH9igSNw+yAaeEGMvcgXBLSNcdOj3GyEb2UY7UjG8k1CRYKjJli5lraBbfZDmSFYLfP0cUIQhK57H7b9Jvd38H9Cp6htjTgqn0DjQLqw3LVOsir3Q/o+Ryteu2/x67SlA1OjvJDZBKBEnOdEPFah2rDBEqjcFTuPZ49TX4DSyhVOVRcUgeIWKoRzRlvhpsVdmYazjHyB4DNghOo9QKy3ONKh1x6iNVdQCHWyjCWAbgtnDNtLANrEF20iBLUVsSyth/tGeNf4V3pbVDGALIpu4Vb2mCXALBqgdALUv6lHblBnGbfKOdNtN0YxpQaPeMLVFC4lCC0UtBrNGFDleBEuxwKvHetO8X4T5ABdZ8cwvc3EJKzGskojKHYH4d11F3vugrsosa1I+butLZRUwZhUvUMONnnlG4YY7Ba34irp+BVqxZQ7DQMH9w+29onImLOMZKJ4OeSEucr4UbpZcBdwp9BcCi8US4itZUBZZhk+FMhPAly+SMXxjFb6BoRAkDBXt/v7HnJQLoqPwTsMNppQbaeJiExbR7Op/s4WTj/5JeNw1mphPIPCSMJb/R9MUhNrSrvmWiWSLRxPSD/F1CyBVFkCGViL7xes0k/DxvWw/0thDU152YsQcXpIbGMWqOYxtuYFd50pSA2FUomaBFfyPrFrXcE45jiC0COMuofKxuTvSeG5xYAuqasSyJKUYsQJX/t5D0dMM0BomNtFqJJN8JgZxbccgcaBBsq3URhLNgQx0KkxskUGshnEtEXAjJTpE/24hbhISZlMPMi6ZYsF74wUfaRZ8olnvyQTrHbhGEHlJSYdYk4O3h9YzOfix5YJV1hqsNo/2SLscWl9/VMu8WZsO4H0eogN4atGipbMPI+JUBXhkK6sWnwl7n/g9B+1C3ea7aLgqDpj/SrgGU0S9nqLPeefRYk1OwVQeLbWUR3s/Lkg0rll64kzV9N6t6poJCnj6+BQQ24zBEpVS57ZRcaxe1yIHmAnBLijCTTVn+qz5A2k6d4rVqTe1pl71yGRGUC2drSZDu0SaTXuMqpyvrHfZpDcXKSeaDU5TkXI69w3OZKzbVHPU2hgnq3sRM7N4x15vqtmCMKVd4Fo6Z2mYdzVbENJPs0G8mlNTzizC21RDosZ8W+Ca2Q67IPer1+/I/4rfiNPm0StK4cugwkacW6gHLR8djQjGMw3c9OhrofP1g8Q9mtt2AD97RKLXjOq9FL+g98LXgs1Ev/oRw8xtLACaxJ05I6smP2btH/ZkYkW7wOKnYpwJ7u58/nPMfi92zM7glQqdIs0MXEufjE1oazs/S7W1b7WrqiGMz50pPMzUm48R8tvDx8Bt9cMH1/7t/w==</diagram></mxfile>
\ No newline at end of file
import time
class lab3:
A = float(time.strftime("%d"))
B = float(time.strftime("%m"))
C = float(time.strftime("%Y"))
print("enter birthday day eg 26")
day = float(input())
print("enter birthday month eg 09")
month = float(input())
print("enter birth year eg 1983")
year = float(input())
daysinayear = float(365.2425)
pedays = day+month*30+year*daysinayear
curdays = A+B*30+C*daysinayear
ageoftheperson = (curdays-pedays)/daysinayear #i could've done it in one line but itwould've been unclear
print ("you are " ,ageoftheperson)
if A == day and B == month :
print("happy birthday")
else:
days1 = A + B*30
days2 = day + month*30
difference = abs(days1 - days2)
print("your birthday is in " ,difference ,"days")
\ No newline at end of file
class __Task1():
tot = 0
res = 0
course=[]
grades = []
student=[]
print("enter name")
Name = input()
print("enter age")
age = int(input())
student = [Name,age]
print("enter number of courses")
numberofcourses = int(input())
for i in range(1, numberofcourses+1):
print("enter name of course n°",i)
A=input()
student.append(A)
print("enter number of grades in course n°",i)
numberofgrades=int(input())
tot = 0
res = 0
for j in range(1, numberofgrades+1):
print("enter grade",j," of course n°",i)
B=float(input())
student.append(B)
tot = tot + B
res = tot/j
print(A,res)
class __Task2():
Stores=[]
cheap = []
print("enter number of store")
Z = int(input())
for g in range(1,Z+1):
print("enter name of store",g)
Y = [input()]
Q= str(Y)
Stores.append(Y)
print("enter number of items")
A=int(input())
for i in range(1,A+1):
print("enter name of the item",i)
B=input()
print("enter price of the item",i)
C=float(input())
if C <10:
cheap.append([Q,B,C])
cheap.sort(key=lambda x: x[2])
Y.append([B,C])
else:
Y.append([B,C])
print(cheap)
class __Task3():
li=[]
for i in range(0, 5):
print("enter a string")
Z=str(input())
li.append(Z)
print(li)
print("type previously entered list")
Y=str(input())
for i in range(0,4):
if str(li[i])==Y:
del li[i]
print(li)
print("enter string")
F = str(input())
li = [F]+li
print(li)
for l in range (0,4):
if len(str(li[l]).split()) >1:
for x in str(li[l]).split():
print (x)
print("type a string")
X=str(input())
S= X[::-1]
print(S)
\ No newline at end of file
class __task1():
Nu = []
St = []
for i in range (0,5):
print("type number")
Nu.append(input())
for j in range (0,5):
print("type string")
St.append(input())
def f(Nu):
res = 0
for h in range (0,5):
res = res + Nu[h]
print(res)
def u(St):
for h in range (0,5):
print (St[h][::-1])
class __task2():
Y="y"
while len(Y) > 50 or len(Y)<30:
print("input")
Y= str(input())
textoutput=open("textfile.txt","w")
textoutput.write(Y)
textoutput=open("textfile.txt","r")
print(textoutput.read())
textoutput.close
\ No newline at end of file
OUTPUTOUTPUTOUTPUTOUTPUTOUTPUTOUTPUT
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment