-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path4.py
71 lines (45 loc) · 1.91 KB
/
4.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
print('''Write the Python code of a program that finds the number of hours, minutes, and seconds
in a given number of seconds. The number of seconds is taken as input from the user.
Use: 1 hour = 60 minutes = 3600 seconds and 1 minute = 60 seconds
Sample Input Sample Output
10000 Hours: 2
Minutes: 46
Seconds: 40
500 Hours: 0
Minutes: 8
Seconds: 20
''')
inp = int(input("Enter seconds value: "))
hours = inp // 3600
rem_hours = inp % 3600
minutes = rem_hours// 60
seconds = rem_hours % 60
print("Hours: " +str(hours)+ " Minutes: " +str(minutes)+ " Seconds: " +str(seconds), end = ' ')
# #Write Python code of a program that finds the number of hours, minutes, and seconds in a given number of seconds.
# #Example01: Input: 10000 Output: Hours: 2 Minutes: 46 Seconds: 40
# #==========================================================
# #Example02: Input: 500 Output: Hours: 0 Minutes: 8 Seconds: 20
x = 500
hr = x//3600
p = x % 3600
min = p//60
q = p % 60
print("Hours:", hr, "Minutes:", min, "Seconds:", q)
given = int(input())
hrs = given // 3600
p = given % 3600
mns = p // 60
sc = p % 60
print(f'Hours: {hrs} Minutes: {mns} Seconds: {sc}')
#Suppose the following expressions are used to calculate the values of L for different values of S:
#𝐿=3000−125𝑆^2 L= 3000− 125S^2 if 𝑆<100 S<100
#𝐿=120004+𝑆2/14900 L=12000^4+S^2/ 14900 if 𝑆≥100 S ≥ 100
#Write a Python code of a program that reads a value of S and then calculates the value of L.
#Example01: Input: 120 Output: 2416.2162162162163. Example02: Input: 3 Output: 1875
S = 120
if S < 100:
L = 3000 - (125*(S**2))
print(L)
elif S >= 100:
L = 12000/(4 + (S**2 / 14900))
print(L)