test file #3

Open
navjotcis wants to merge 1 commits from navjotcis/master into master

49
updated_dat_num.py Normal file
View File

@ -0,0 +1,49 @@
input_val = [[12, 15], [38, 42], [45.50, 47.75]]
PeterSurda commented 2020-04-29 15:32:21 +02:00 (Migrated from github.com)
Review

1

1
# output - Monday 12:00-15:00, Tuesday 14:00-18:00, Tuesday 21:30-23:45
PeterSurda commented 2020-04-29 15:32:33 +02:00 (Migrated from github.com)
Review

2

2
PeterSurda commented 2020-04-29 15:32:39 +02:00 (Migrated from github.com)
Review

3

3
output = ''
PeterSurda commented 2020-04-29 15:32:43 +02:00 (Migrated from github.com)
Review

4

4
PeterSurda commented 2020-04-29 15:32:52 +02:00 (Migrated from github.com)
Review

5

5
days = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday']
PeterSurda commented 2020-04-29 15:33:03 +02:00 (Migrated from github.com)
Review

6

6
PeterSurda commented 2020-04-29 15:33:19 +02:00 (Migrated from github.com)
Review

7

7
temp_opt = []
PeterSurda commented 2020-04-29 15:33:29 +02:00 (Migrated from github.com)
Review

8

8
def convert_float(obj):
PeterSurda commented 2020-04-29 15:33:42 +02:00 (Migrated from github.com)
Review

9

9
if isinstance(obj, float):
PeterSurda commented 2020-04-29 15:33:47 +02:00 (Migrated from github.com)
Review

10

10
flot = str(obj).split('.')
PeterSurda commented 2020-04-29 15:33:52 +02:00 (Migrated from github.com)
Review

11

11
return str(int(flot[0])%24)+':'+str(60*int(flot[1])/100)
PeterSurda commented 2020-04-29 15:33:56 +02:00 (Migrated from github.com)
Review

12

12
else:
PeterSurda commented 2020-04-29 15:34:01 +02:00 (Migrated from github.com)
Review

13

13
return str(obj%24)+':00'
PeterSurda commented 2020-04-29 15:34:05 +02:00 (Migrated from github.com)
Review

14

14
PeterSurda commented 2020-04-29 15:34:11 +02:00 (Migrated from github.com)
Review

15

15
PeterSurda commented 2020-04-29 15:34:19 +02:00 (Migrated from github.com)
Review

16

16
for objs in input_val:
PeterSurda commented 2020-04-29 15:34:24 +02:00 (Migrated from github.com)
Review

17

17
if isinstance(objs[0], float) and isinstance(objs[1], float):
PeterSurda commented 2020-04-29 15:34:29 +02:00 (Migrated from github.com)
Review

18

18
# import pdb;pdb.set_trace()
PeterSurda commented 2020-04-29 15:34:35 +02:00 (Migrated from github.com)
Review

19

19
# flot = str(obj).split('.')
PeterSurda commented 2020-04-29 15:34:42 +02:00 (Migrated from github.com)
Review

20

20
# opt.append(str(int(flot[0])%24)+':'+str(60*int(flot[1])/100))
PeterSurda commented 2020-04-29 15:34:48 +02:00 (Migrated from github.com)
Review

21

21
temp_opt = '{}-{}'.format(convert_float(objs[0]),convert_float(objs[1]))
PeterSurda commented 2020-04-29 15:34:54 +02:00 (Migrated from github.com)
Review

22

22
# print(convert_float(objs[0]),convert_float(objs[1]))
PeterSurda commented 2020-04-29 15:34:59 +02:00 (Migrated from github.com)
Review

23

23
elif isinstance(objs[0], int) or isinstance(objs[1], float):
PeterSurda commented 2020-04-29 15:35:03 +02:00 (Migrated from github.com)
Review

24

24
temp_opt = '{}-{}'.format(convert_float(objs[0]),convert_float(objs[1]))
PeterSurda commented 2020-04-29 15:35:08 +02:00 (Migrated from github.com)
Review

25

25
# print(convert_float(objs[0]),convert_float(objs[1]))
PeterSurda commented 2020-04-29 15:35:13 +02:00 (Migrated from github.com)
Review

26

26
elif isinstance(objs[0], float) or isinstance(objs[1], int):
PeterSurda commented 2020-04-29 15:35:19 +02:00 (Migrated from github.com)
Review

27

27
temp_opt = '{}-{}'.format(convert_float(objs[0]),convert_float(objs[1]))
PeterSurda commented 2020-04-29 15:35:24 +02:00 (Migrated from github.com)
Review

28

28
# print(convert_float(objs[0]),convert_float(objs[1]))
PeterSurda commented 2020-04-29 15:35:47 +02:00 (Migrated from github.com)
Review

29

29
else:
PeterSurda commented 2020-04-29 15:35:52 +02:00 (Migrated from github.com)
Review

30

30
temp_opt = '{}-{}'.format(convert_float(objs[0]),convert_float(objs[1]))
PeterSurda commented 2020-04-29 15:35:56 +02:00 (Migrated from github.com)
Review

31

31
# print(convert_float(objs[0]),convert_float(objs[1]))
PeterSurda commented 2020-04-29 15:36:00 +02:00 (Migrated from github.com)
Review

32

32
print(temp_opt)
PeterSurda commented 2020-04-29 15:36:19 +02:00 (Migrated from github.com)
Review

33

33
PeterSurda commented 2020-04-29 15:36:23 +02:00 (Migrated from github.com)
Review

34

34
PeterSurda commented 2020-04-29 15:36:28 +02:00 (Migrated from github.com)
Review

35

35
PeterSurda commented 2020-04-29 15:36:33 +02:00 (Migrated from github.com)
Review

36

36
# opt = []
PeterSurda commented 2020-04-29 15:36:37 +02:00 (Migrated from github.com)
Review

37

37
# for obj in objs:
PeterSurda commented 2020-04-29 15:36:43 +02:00 (Migrated from github.com)
Review

38

38
# day_obj = 0
PeterSurda commented 2020-04-29 15:36:48 +02:00 (Migrated from github.com)
Review

39

39
# if isinstance(obj, float):
PeterSurda commented 2020-04-29 15:36:53 +02:00 (Migrated from github.com)
Review

40

40
# flot = str(obj).split('.')
PeterSurda commented 2020-04-29 15:36:58 +02:00 (Migrated from github.com)
Review

41

41
# # import pdb;pdb.set_trace()
PeterSurda commented 2020-04-29 15:37:04 +02:00 (Migrated from github.com)
Review

42

42
# opt.append(str(int(flot[0])%24)+':'+str(60*int(flot[1])/100))
PeterSurda commented 2020-04-29 15:37:09 +02:00 (Migrated from github.com)
Review

43

43
# else:
PeterSurda commented 2020-04-29 15:37:13 +02:00 (Migrated from github.com)
Review

44

44
# opt.append(str(obj%24)+':00')
PeterSurda commented 2020-04-29 15:37:18 +02:00 (Migrated from github.com)
Review

45

45
# day_obj = obj%24/24.0
PeterSurda commented 2020-04-29 15:37:23 +02:00 (Migrated from github.com)
Review

46

46
# day_obj = days[int(objs[0]/24)] if isinstance(objs[0], float) else days[int(objs[0]/24)]
PeterSurda commented 2020-04-29 15:37:27 +02:00 (Migrated from github.com)
Review

47

47
# # print(day_obj)
PeterSurda commented 2020-04-29 15:37:36 +02:00 (Migrated from github.com)
Review

48

48
# print '-'.join(opt)