Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
inlab6
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
YASH AJITBHAI PARMAR
inlab6
Commits
41a9825d
Commit
41a9825d
authored
Aug 21, 2018
by
SAURAV YADAV
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://git.cse.iitb.ac.in/yashap/inlab6
parents
873464dd
a4dd1cf5
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
78 additions
and
0 deletions
+78
-0
170050004/inlab_python/__pycache__/movies.cpython-35.pyc
170050004/inlab_python/__pycache__/movies.cpython-35.pyc
+0
-0
170050004/inlab_python/edit.py
170050004/inlab_python/edit.py
+20
-0
170050004/inlab_python/highfive.py
170050004/inlab_python/highfive.py
+19
-0
170050004/inlab_python/load.py
170050004/inlab_python/load.py
+8
-0
170050004/inlab_python/movies.py
170050004/inlab_python/movies.py
+7
-0
170050004/inlab_python/pickle
170050004/inlab_python/pickle
+0
-0
170050004/inlab_python/pickle.p
170050004/inlab_python/pickle.p
+0
-0
170050004/inlab_python/store.py
170050004/inlab_python/store.py
+16
-0
170050004/inlab_python/student_db.py
170050004/inlab_python/student_db.py
+8
-0
No files found.
170050004/inlab_python/__pycache__/movies.cpython-35.pyc
0 → 100644
View file @
41a9825d
File added
170050004/inlab_python/edit.py
0 → 100644
View file @
41a9825d
import
pickle
from
movies
import
Movie
name
=
input
(
'Enter movie name: '
)
rate
=
int
(
input
(
'Enter rating of the movie: '
))
with
open
(
'pickle.p'
,
'rb+'
)
as
f
:
lst
=
pickle
.
load
(
f
)
for
i
in
lst
:
if
i
.
movieName
==
name
:
i
.
rating
=
rate
break
else
:
lst
.
append
(
Movie
(
name
,
rating
))
for
i
in
sorted
(
lst
,
key
=
lambda
x
:
x
.
rating
,
reverse
=
True
):
print
(
i
.
movieName
,
i
.
rating
)
f
.
close
()
f
=
open
(
'pickle.p'
,
'wb'
)
pickle
.
dump
(
lst
,
f
)
\ No newline at end of file
170050004/inlab_python/highfive.py
0 → 100644
View file @
41a9825d
# Task1
# import random
# num=random.randint(1,9)
# while num==5:
# num=random.randint(1,9)
import
time
num
=
str
(
time
.
time
())[
-
2
]
while
num
==
'5'
:
num
=
str
(
time
.
time
())[
-
2
]
num
=
int
(
num
)
guess
=
input
(
'High or Low? :'
)
if
guess
.
lower
()
==
'high'
and
num
>
5
:
print
(
'Generated random number was {}. You guessed Correct.'
.
format
(
num
))
elif
guess
.
lower
()
==
'low'
and
num
<
5
:
print
(
'Generated random number was {}. You guesses Correct.'
.
format
(
num
))
else
:
print
(
'Generated random number was {}. You guessed Incorrect.'
.
format
(
num
))
170050004/inlab_python/load.py
0 → 100644
View file @
41a9825d
from
movies
import
Movie
import
pickle
with
open
(
'pickle.p'
,
'rb'
)
as
f
:
l
=
pickle
.
load
(
f
)
print
(
'Movie, Rating'
)
for
i
in
sorted
(
l
,
key
=
lambda
x
:
x
.
rating
,
reverse
=
True
):
print
(
i
.
movieName
,
i
.
rating
)
170050004/inlab_python/movies.py
0 → 100644
View file @
41a9825d
class
Movie
(
object
):
def
__init__
(
self
,
movieName
=
''
,
rating
=
0
):
super
(
Movie
,
self
)
.
__init__
()
self
.
movieName
=
movieName
self
.
rating
=
rating
\ No newline at end of file
170050004/inlab_python/pickle
0 → 100644
View file @
41a9825d
File added
170050004/inlab_python/pickle.p
0 → 100644
View file @
41a9825d
File added
170050004/inlab_python/store.py
0 → 100644
View file @
41a9825d
from
movies
import
Movie
import
pickle
lstMovies
=
[]
def
addMovie
(
movie_name
,
rating
):
lstMovies
.
append
(
Movie
(
movie_name
,
rating
))
addMovie
(
'some'
,
4
)
addMovie
(
'strangerthings'
,
7
)
addMovie
(
'f4'
,
6
)
addMovie
(
'ted'
,
5
)
addMovie
(
'je'
,
4
)
f
=
open
(
'pickle.p'
,
'ab+'
)
pickle
.
dump
(
lstMovies
,
f
)
f
.
close
()
\ No newline at end of file
170050004/inlab_python/student_db.py
0 → 100644
View file @
41a9825d
# TODO: take input from stdin and create student_db.csv
# USE ARGUMENT PARSER FOR THIS TASK
# IF file already exist append the new information.
# Display error if any argument is missing (i.e raise an error using try except)
import
argparse
#overwrite parse.error
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