Repository navigation
Expand file tree
/
Copy pathPython_Review_Tasks_5.py
More file actions
105 lines (72 loc) · 1.95 KB
/
Copy pathPython_Review_Tasks_5.py
File metadata and controls
105 lines (72 loc) · 1.95 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# def cubesum(n):
# sum = 0
# while (n!= 0):
# sum = sum + ((n % 10)**3)
# n = n//10
# return sum
# def PrintArmStrong(n):
# for i in range(100,n):
# if (cubesum(i)==i):
# print(i)
# PrintArmStrong(1000)
# def isArmstrong(n):
# if (cubesum(n)==n):
# print(n,'is an armstrong number.')
# else:
# print(n,'is not an armstrong number.')
# isArmstrong(13)
# isArmstrong(371)
# def prodDigits(n):
# product = 1
# while (n!= 0):
# product = product * (n % 10)
# n = n//10
# return product
# num = int(input("Enter a number: "))
# print(prodDigits(num))
# def sumPdivisors(n):
# x = []
# for i in range(1, n):
# if (n % i == 0):
# x.append(i)
# print(x)
# return sum(x)
# num = int(input("Enter a number: "))
# sumPdivisors(num)
# def perfect(n):
# x = []
# for i in range(1,n):
# if (n % i==0):
# x.append(i)
# return sum(x)
# def is_perfect(n):
# for i in range(1, n + 1):
# if (perfect(i) == i):
# print(i)
# num = int(input("Enter a number: "))
# is_perfect(num)
# def amicable(n):
# x = []
# for i in range(1, n):
# if(n % i == 0):
# x.append(i)
# return x
# def is_amicable(x, y):
# if sum(amicable(x)) == y and sum(amicable(y)) == x:
# print(x, 'and', y, 'are amicable numbers')
# else:
# print(x, 'and', y, 'are not amicable numbers')
# is_amicable(220,284)
# from datetime import datetime, timedelta
# given_date = datetime(2020, 3, 22, 10, 00, 00)
# print(given_date)
# days_add = 7
# date = given_date + timedelta(days = days_add, hours = 12)
# print(date)
# import time
# milliseconds = int(round(time.time() * 1000))
# print(milliseconds)
# from datetime import datetime
# given_date = datetime(2020, 2, 25)
# date_string = given_date.strftime("%Y-%m-%d %H:%M:%S")
# print(date_string)