Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SpartanBots
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Roshan Rabinarayan
SpartanBots
Commits
508dd088
Commit
508dd088
authored
Sep 19, 2020
by
Sanchit
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
uploading q3 and q6
parent
7e6735fa
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
10 deletions
+58
-10
q3/q3.py
q3/q3.py
+0
-9
q3/q3plot.jpg
q3/q3plot.jpg
+0
-0
q6/q6.py
q6/q6.py
+58
-1
No files found.
q3/q3.py
View file @
508dd088
...
@@ -8,15 +8,6 @@ ax=plt.axes(projection='3d')
...
@@ -8,15 +8,6 @@ ax=plt.axes(projection='3d')
x_points
,
y_points
,
z_points
=
np
.
genfromtxt
(
'csv_file'
,
delimiter
=
','
,
unpack
=
True
)
x_points
,
y_points
,
z_points
=
np
.
genfromtxt
(
'csv_file'
,
delimiter
=
','
,
unpack
=
True
)
"""
x_axis=pd.read_csv("csv_file",names=['x','y','z'],usecols=['x'])
y_axis=pd.read_csv("csv_file",names=['x','y','z'],usecols=['y'])
z_axis=pd.read_csv("csv_file",names=['x','y','z'],usecols=['z'])
x_points=x_axis.to_numpy()
y_points=y_axis.to_numpy()
z_points=z_axis.to_numpy()"""
graph
=
ax
.
scatter3D
(
x_points
,
y_points
,
z_points
,
c
=
z_points
,
cmap
=
'coolwarm'
)
graph
=
ax
.
scatter3D
(
x_points
,
y_points
,
z_points
,
c
=
z_points
,
cmap
=
'coolwarm'
)
colorbar
(
graph
,
shrink
=
0.5
)
colorbar
(
graph
,
shrink
=
0.5
)
ax
.
set_xlabel
(
'X axis'
,
fontweight
=
'bold'
)
ax
.
set_xlabel
(
'X axis'
,
fontweight
=
'bold'
)
...
...
q3/q3plot.jpg
View replaced file @
7e6735fa
View file @
508dd088
91 KB
|
W:
|
H:
91.6 KB
|
W:
|
H:
2-up
Swipe
Onion skin
q6/q6.py
View file @
508dd088
from
functools
import
total_ordering
class
BlackMoneyHolder
:
class
BlackMoneyHolder
:
## write your code here
def
__init__
(
self
,
name
,
accounts_info
):
\ No newline at end of file
self
.
name
=
name
self
.
accounts_info
=
accounts_info
if
isinstance
(
name
,
str
)
==
False
or
name
==
None
or
len
(
name
)
==
0
:
raise
Exception
(
"Not a valid name"
)
if
(
isinstance
(
accounts_info
,
dict
)
==
False
):
raise
Exception
(
"Not a valid Datatype of account information"
)
def
__len__
(
self
):
return
len
(
self
.
accounts_info
)
def
__getitem__
(
self
,
item
):
return
self
.
accounts_info
[
item
]
def
__eq__
(
self
,
other
):
return
self
.
total_black_money
()
==
other
.
total_black_money
()
def
__lt__
(
self
,
other
):
return
self
.
total_black_money
()
<
other
.
total_black_money
()
def
__gt__
(
self
,
other
):
return
self
.
total_black_money
()
>
other
.
total_black_money
()
def
__str__
(
self
):
for
i
in
self
.
accounts_info
:
print
(
"
%
s:
%
s"
%
(
i
,
self
.
accounts_info
[
i
]))
return
''
def
update_amount
(
self
,
name
,
amount
):
self
.
accounts_info
[
name
]
=
amount
def
total_black_money
(
self
):
total_money
=
0
for
i
in
accounts_info
:
total_money
+=
self
.
accounts_info
.
get
(
i
)
return
total_money
name
=
"Gonia Sandhi"
accounts_info
=
{
"Random Bank"
:
1000
,
"Dena Bank"
:
4000
,
"Lena Bank"
:
2000
,
}
b1
=
BlackMoneyHolder
(
name
,
accounts_info
)
print
(
b1
.
total_black_money
())
b1
.
update_amount
(
"Blood Bank"
,
2500
)
print
(
b1
.
total_black_money
())
name
=
"Champak Lal"
accounts_info
=
{
"Random Bank"
:
2000
,
"Dena Bank"
:
7000
,
"Lena Bank"
:
9000
,
}
b2
=
BlackMoneyHolder
(
name
,
accounts_info
)
print
(
b2
.
total_black_money
())
print
(
b1
==
b2
,
b1
>
b2
,
b1
<
b2
)
print
(
b1
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment