-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a65f8a4
commit 2ea58cb
Showing
9 changed files
with
90 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
class student(): | ||
name = "rakesh" | ||
website ="binarynote.com" | ||
expertise ="PHP, CSS, HTML,JavaScript,JQuery,WordPress and Now Python Django" | ||
|
||
def setData(self,name,web,exp): | ||
self.name = name | ||
self.website = web | ||
self.expertise = exp | ||
|
||
def showData(self): | ||
print("Name : ",self.name) | ||
print("website : ", self.website) | ||
print("Expertise :", self.expertise,"\n") | ||
|
||
#object creation | ||
s = student() | ||
s.showData() | ||
|
||
# set new Data using another function | ||
s.setData("Swarnima", 'swarnima.com','Python, Django, CSS, JavaScript') | ||
s.showData() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
class student(): | ||
name="" | ||
website="" | ||
expertise="" | ||
|
||
def __init__(self): | ||
self.name ="swarnima" | ||
self.website = "http://www.swarnima.com" | ||
self.expertise ="Django Specialist" | ||
|
||
def showData(self): | ||
print("Name : ",self.name) | ||
print("website : ", self.website) | ||
print("Expertise :", self.expertise,"\n") | ||
|
||
#object creation | ||
# | ||
|
||
s1 = student() #calling constructor | ||
s1.showData() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
def front3(str): | ||
str1 = str[:3]*3 | ||
print(str1) | ||
|
||
front3('java') | ||
front3('Chocolate') | ||
front3('ab') | ||
front3('a') | ||
front3('') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
def factorial(): | ||
n = int(input("Enter any number ")) | ||
fact = 1 | ||
for i in range(1,n+1): | ||
fact *= i | ||
print("Factorial of ", n ," is :",fact) | ||
|
||
#function call | ||
factorial() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
def factorial(n): | ||
fact = 1 | ||
for i in range(1,n+1): | ||
fact *= i | ||
print("Factorial of ", n ," is :",fact) | ||
|
||
#function call | ||
n = int(input("Enter any number ")) | ||
factorial(n) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
def factorial(n): | ||
if n==1: | ||
return 1 | ||
else: | ||
return n*(factorial(n-1)) | ||
|
||
#function call | ||
n = int(input("Enter any number ")) | ||
result = factorial(n) | ||
print("factorial of {} is {} ".format(n,result)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
str = "This is me rakesh" | ||
n = len(str) | ||
print('Length of string is : ',n) | ||
str = str + "Hello rakesh" | ||
print(str) | ||
print(str[0]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters