Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place your settings in this file to overwrite default and user settings.
{
}
54 changes: 54 additions & 0 deletions api-repo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/usr/bin/env python

import requests
import json

# main api url
url = 'https://api.github.com/users/'


# put your username/password here
#auth = ('myUsername', 'myPassword')

# request an authorization token from the server
#response = requests.get(url + '/user/authentication',
# auth=auth, verify=False).json()

# get the token from the response
#token = response['authToken']['token']

# to make an api call using this token,
# add a token parameter to the request
#params = {
# 'token': token,
# 'start': '2014-01-15',
# 'end': '2014-02-01',
# 'geoJSON': 1,
# 'limit': 10
#}
name = raw_input("What is your name? ")

if name != "":
response = requests.get(url + name).json()
else:
print "Please enter a GITHub username."
# response contains the geoJSON object,
# pretty print it to the console
#print json.dumps(response, indent=4)
dic = {}
dic = response

for k,v in dic.iteritems():
print str(k) + ':' + str(v)

if response['login'] != None:
print "+++++++++++++++++++++++++++++++++++++++++"
print "My master's name is "+response['login']
if response['bio'] != None:
print "++++++++++++"
print "And his identity is: "+response['bio']
print "+++++++++++++++++++++++++++++++++++++++++"
else:
print "He is too lazy to write a bio"
else:
print "This is not my master!!!!"
11 changes: 11 additions & 0 deletions books/author.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class Author:
count = 0

def __init__(self, name, gender, rating):
self.name = name
self.gender = gender
self.rating = rating
Author.count += 1

def get_details(self):
return 'Name: {0}, Gender: {1}, Rating: {2}'.format(self.name, self.gender, self.rating)
Binary file added books/author.pyc
Binary file not shown.
23 changes: 23 additions & 0 deletions books/book.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
class Book:
def __init__(self, title, pages, price, authors=None):
self.title = title
self.pages = pages
self.price = price
self.authors = authors

def has_authors(self):
if self.authors:
return True
else:
return False

def get_details(self):
details = ''
details = 'Title: {0}\nPages: {1}\nPrice: {2}'.format(self.title, self.pages, self.price)
if self.has_authors():
for auth in self.authors:
details = details + '\n' + auth.get_details()

return details


Binary file added books/book.pyc
Binary file not shown.
16 changes: 16 additions & 0 deletions books/run_library.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from book import Book
from author import Author

a1 = Author('abc', 'm', 5)
a2 = Author('jane', 'f', 4)

b1 = Book('book1', 100, 400)
b2 = Book('book2', pages=700, price=900, authors=[a1, a2])

#print b1.has_authors()
print b1.get_details()
print '--------------'
print b2.get_details()
#print b2.has_authors()
print '--------------'
print Author.count
20 changes: 16 additions & 4 deletions fibo.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
#Fibo series generator

#line 1
# line 2
n = int(raw_input('enter n: '))
a,b = 0,1
print a
print b
'''i = 2
while i <= n:
c = a + b
print c
a,b = b,c
i = i + 1'''
for i in range(2,n):
c = a + b
print c
a,b = b,c


20 changes: 10 additions & 10 deletions hello.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# hello
if __name__ == '__main__':
print 'hello world'

print 'hello world'
#print 'Good Night'
#print 'Good Evening'

#print 'Good Night'
#print 'Good Evening'
msg = 'Good Night to all'
print msg

msg = 'Good Night to all'
print msg
#Call fibo module to print fibo series

#Call fibo module to print fibo series

#new code added.
#another addition to master file only
# integration with feature 2 resolved the bug toooooo
#new code added.
#another addition to master file only
# integration with feature 2 resolved the bug toooooo



Binary file added hello.pyc
Binary file not shown.
9 changes: 9 additions & 0 deletions marks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
marks = float(raw_input('enter marks: '))
if marks >= 70:
print 'A'
elif marks >= 60:
print 'B'
elif marks >= 40:
print 'C'
else:
print 'Fail'
2 changes: 0 additions & 2 deletions student.py

This file was deleted.

17 changes: 17 additions & 0 deletions student/student.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
class Student:
def __init__(self, name, gender, roll, marks):
self.name = name
self.gender = gender
self.roll = roll
self.marks = marks

def get_grade(self):
marks = self.marks
if marks >= 70:
return 'A'
elif marks >= 60:
return 'B'
elif marks >= 40:
return 'C'
else:
return 'Fail'
Binary file added student/student.pyc
Binary file not shown.
24 changes: 24 additions & 0 deletions student/studentlib.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from student import Student

x = 5
s1 = Student('mehul',m,10,89)
s2 = Student('Jane',f, 11,86)

print id(s1)
print id(s2)
print type(s1)
print type(s2)


s1.name = 'Mehul'
s1.gender = 'm'
s1.roll = 10
s1.marks = 70

s2.name = 'Mehul'
s2.gender = 'f'
s2.roll = 10
s2.marks = 70

print s2.roll
print s1.marks
24 changes: 24 additions & 0 deletions student_class.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
class Student:
def __init__(self, name, gender, roll, marks):
self.name = name
self.gender = gender
self.roll = roll
self.marks = marks

def get_detail(self):
return 'Name: ' + str(self.name) + '\nGender: ' + str(self.gender) + '\nRoll: ' + str(self.roll)

def get_name_roll(self):
return (self.name, self.roll)

def get_grade(self):
if self.marks >= 70:
return 'A'
elif self.marks >= 60:
return 'B'
elif self.marks >= 40:
return 'C'
else:
return 'Fail'


Binary file added student_class.pyc
Binary file not shown.
28 changes: 28 additions & 0 deletions student_input.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
'''from student_ops import get_details, get_grade


name = str(raw_input('Enter Student Name: '))
gender = str(raw_input('Enter Gender: '))
roll = input('Enter Roll: ')
marks = input('Enter Marks: ')

print get_details(name, gender, roll)
print name + ' got a grade ' + get_grade(marks)
'''

from student_class import Student

s1 = Student('Arun', 'm', 45, 89)
s2 = Student('Karan', 'm', 100, 46)

print s1.get_detail()
print s2.get_detail()


print s1.get_grade()
print s2.get_grade()

tufle = s1.get_name_roll()

for i in tufle:
print i
14 changes: 14 additions & 0 deletions student_ops.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
def get_details(name, gender, roll):
return 'Name: ' + str(name) + '\nGender: ' + str(gender) + '\nRoll: ' + str(roll)

def get_grade(marks):
if marks >= 70:
return 'A'
elif marks >= 60:
return 'B'
elif marks >= 40:
return 'C'
else:
return 'Fail'


Binary file added student_ops.pyc
Binary file not shown.
Empty file added testing/__init__.py
Empty file.
Binary file added testing/__init__.pyc
Binary file not shown.
Empty file added testing/matlib/__init__.py
Empty file.
Binary file added testing/matlib/__init__.pyc
Binary file not shown.
5 changes: 5 additions & 0 deletions testing/matlib/math_ops.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
def evenodd(n):
if n % 2 == 0:
return True
else:
return False
Binary file added testing/matlib/math_ops.pyc
Binary file not shown.
16 changes: 16 additions & 0 deletions testing/matlib/series.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
def fibo(n):
series = ''
a,b = 0,1
series = series + str(a) + '\t' + str(b) + '\t'
for i in range(2,n):
c = a + b
series = series + str(c) + '\t'
a,b = b,c
return(series)

def even(n):
series = ''
for i in range(0, n+1,2):
series = series + str(i) + '\t'

return(series)
Binary file added testing/matlib/series.pyc
Binary file not shown.
34 changes: 34 additions & 0 deletions while.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#import series
from testing.matlib.series import fibo, even
import testing.matlib.math_ops as mo
import math

print math.pi

while True:
print '1. Fibo Series'
print '2. Even Series'
print '3. Even or Odd'
print '4. Exit'

choice = int(raw_input('What is your choice: '))
if choice != 4:
n = int(raw_input('Enter the value of N: '))

if choice == 1:
print fibo(n)
elif choice == 2:
print even(n)
elif choice == 3:
if mo.evenodd(n):
print 'is even'
else:
print 'is odd'
else:
break


#add python path to the modules