-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodule_result.py
More file actions
81 lines (56 loc) · 1.86 KB
/
module_result.py
File metadata and controls
81 lines (56 loc) · 1.86 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
# using modeles function in this file
# import module as m
from module import adding2Numbers as add
num1 = int(input('Enter first number: '))
num2 = int(input('Enter second number: '))
print('\nSum result: ',add(num1, num2))
# print('\nMultiplication result: ',multiply2Numbers(num1, num2))
# print('\nUser names: ',m.listOfUsers)
# python have lot's of predienife modules
import platform as p
checkSystem = p.system()
print('\nCheck system: ',checkSystem)
print('\nCurrent platformr realted directorys: ',dir(p))
# date
import datetime as d
date = d.datetime.now()
print('\nCurrent date: ',date)
print('\nYear: ',date.year)
print('\nCurrent Day: ',date.strftime('%a'))
print('\nCurrent Day: ',date.strftime('%A'))
print('\nCurrent Month: ',date.strftime('%m'))
print('\nCurrent Year: ',date.strftime('%y'))
print('\nCurrent Year: ',date.strftime('%Y'))
print('\nComple date: {} - ({})/{} - ({})/{}'.format(date.strftime('%d'),date.strftime('%A'),date.strftime('%m'),date.strftime('%B'),date.strftime('%Y')))
# math
print('\nfind nMinimu value: ',min(4,1,2,6,3,7,9))
print('Find numerb is absolute or not: ',abs(-222.949))
print('power of 3 is 2: ',pow(3,2))
# math library
import math
print('value of pi: ',math.pi)
print('sqrt of 5: ',math.sqrt(5))
# print('other methods: ',math.)
# json: javascript object notation
import json
# json formt data
jsondata = '{"name":"ravi","course":"python"}'
print('chiech jsondata type: ',type(jsondata))
# convet jason to python dict
convetJsontoPython = json.loads(jsondata)
print('chiech jsondata type: ',type(convetJsontoPython))
print('name: ',convetJsontoPython['name'])
# python to json convertion
convetPythonToJson = json.dumps(convetJsontoPython)
print('convetPythonToJson: ',convetPythonToJson)
print('convetPythonToJson type; ',type(convetPythonToJson))
'''
Ptyhon data convet ot json
dict
list
tuple
stirng
int
float
boolean
'''