test file #3

Open
navjotcis wants to merge 1 commits from navjotcis/master into master
1 changed files with 49 additions and 0 deletions

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 13:32:21 +00: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 13:32:33 +00:00 (Migrated from github.com)
Review

2

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

3

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

4

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

5

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

6

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

7

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

8

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

9

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

10

10
flot = str(obj).split('.')
PeterSurda commented 2020-04-29 13:33:52 +00: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 13:33:56 +00:00 (Migrated from github.com)
Review

12

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

13

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

14

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

15

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

16

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

17

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

18

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

19

19
# flot = str(obj).split('.')
PeterSurda commented 2020-04-29 13:34:42 +00: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 13:34:48 +00:00 (Migrated from github.com)
Review

21

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

22

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

23

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

24

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

25

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

26

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

27

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

28

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

29

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

30

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

31

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

32

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

33

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

34

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

35

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

36

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

37

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

38

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

39

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

40

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

41

41
# # import pdb;pdb.set_trace()
PeterSurda commented 2020-04-29 13:37:04 +00: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 13:37:09 +00:00 (Migrated from github.com)
Review

43

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

44

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

45

45
# day_obj = obj%24/24.0
PeterSurda commented 2020-04-29 13:37:23 +00: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 13:37:27 +00:00 (Migrated from github.com)
Review

47

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

48

48
# print '-'.join(opt)