diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..20af2f6 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +// Place your settings in this file to overwrite default and user settings. +{ +} \ No newline at end of file diff --git a/api-repo.py b/api-repo.py new file mode 100644 index 0000000..27de0e5 --- /dev/null +++ b/api-repo.py @@ -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!!!!" \ No newline at end of file diff --git a/books/author.py b/books/author.py new file mode 100644 index 0000000..b4527dc --- /dev/null +++ b/books/author.py @@ -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) \ No newline at end of file diff --git a/books/author.pyc b/books/author.pyc new file mode 100644 index 0000000..ffef26c Binary files /dev/null and b/books/author.pyc differ diff --git a/books/book.py b/books/book.py new file mode 100644 index 0000000..617cc80 --- /dev/null +++ b/books/book.py @@ -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 + + diff --git a/books/book.pyc b/books/book.pyc new file mode 100644 index 0000000..c42f383 Binary files /dev/null and b/books/book.pyc differ diff --git a/books/run_library.py b/books/run_library.py new file mode 100644 index 0000000..c9c0fac --- /dev/null +++ b/books/run_library.py @@ -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 \ No newline at end of file diff --git a/fibo.py b/fibo.py index d82d5c2..add60ac 100644 --- a/fibo.py +++ b/fibo.py @@ -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 + + \ No newline at end of file diff --git a/hello.py b/hello.py index d668898..23bde08 100644 --- a/hello.py +++ b/hello.py @@ -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 diff --git a/hello.pyc b/hello.pyc new file mode 100644 index 0000000..2c61e55 Binary files /dev/null and b/hello.pyc differ diff --git a/marks.py b/marks.py new file mode 100644 index 0000000..6659856 --- /dev/null +++ b/marks.py @@ -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' \ No newline at end of file diff --git a/student.py b/student.py deleted file mode 100644 index cb38228..0000000 --- a/student.py +++ /dev/null @@ -1,2 +0,0 @@ -#student modulte deploying -#completed my feature \ No newline at end of file diff --git a/student/student.py b/student/student.py new file mode 100644 index 0000000..c6b11b2 --- /dev/null +++ b/student/student.py @@ -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' diff --git a/student/student.pyc b/student/student.pyc new file mode 100644 index 0000000..6a2fb13 Binary files /dev/null and b/student/student.pyc differ diff --git a/student/studentlib.py b/student/studentlib.py new file mode 100644 index 0000000..bc132f2 --- /dev/null +++ b/student/studentlib.py @@ -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 \ No newline at end of file diff --git a/student_class.py b/student_class.py new file mode 100644 index 0000000..fda49f8 --- /dev/null +++ b/student_class.py @@ -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' + + diff --git a/student_class.pyc b/student_class.pyc new file mode 100644 index 0000000..3b41b96 Binary files /dev/null and b/student_class.pyc differ diff --git a/student_input.py b/student_input.py new file mode 100644 index 0000000..ba48ba0 --- /dev/null +++ b/student_input.py @@ -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 \ No newline at end of file diff --git a/student_ops.py b/student_ops.py new file mode 100644 index 0000000..3c7ea81 --- /dev/null +++ b/student_ops.py @@ -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' + + diff --git a/student_ops.pyc b/student_ops.pyc new file mode 100644 index 0000000..fb78ca0 Binary files /dev/null and b/student_ops.pyc differ diff --git a/testing/__init__.py b/testing/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/testing/__init__.pyc b/testing/__init__.pyc new file mode 100644 index 0000000..06e008e Binary files /dev/null and b/testing/__init__.pyc differ diff --git a/testing/matlib/__init__.py b/testing/matlib/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/testing/matlib/__init__.pyc b/testing/matlib/__init__.pyc new file mode 100644 index 0000000..77a197c Binary files /dev/null and b/testing/matlib/__init__.pyc differ diff --git a/testing/matlib/math_ops.py b/testing/matlib/math_ops.py new file mode 100644 index 0000000..8b86d45 --- /dev/null +++ b/testing/matlib/math_ops.py @@ -0,0 +1,5 @@ +def evenodd(n): + if n % 2 == 0: + return True + else: + return False \ No newline at end of file diff --git a/testing/matlib/math_ops.pyc b/testing/matlib/math_ops.pyc new file mode 100644 index 0000000..17a0f5e Binary files /dev/null and b/testing/matlib/math_ops.pyc differ diff --git a/testing/matlib/series.py b/testing/matlib/series.py new file mode 100644 index 0000000..2d26f69 --- /dev/null +++ b/testing/matlib/series.py @@ -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) \ No newline at end of file diff --git a/testing/matlib/series.pyc b/testing/matlib/series.pyc new file mode 100644 index 0000000..e8d1e8c Binary files /dev/null and b/testing/matlib/series.pyc differ diff --git a/while.py b/while.py new file mode 100644 index 0000000..7c7b140 --- /dev/null +++ b/while.py @@ -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 + + + \ No newline at end of file