Skip to content

Commit

Permalink
REcursion function
Browse files Browse the repository at this point in the history
  • Loading branch information
rakeshlinux committed Dec 1, 2019
1 parent 753befa commit 0c788d2
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 12 deletions.
2 changes: 1 addition & 1 deletion comm_code.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# purpose : write a program to read a list and convert that list into comma seperated string
# author : rakesh kumar
# licence : MIT
spam =['apples','banana','oranges','mango']
spam =['apples','banana','oranges','mango','kivi','cheeku','pine apple','strawberries']
string =''
n = len(spam)
for i in range(1,n):
Expand Down
14 changes: 6 additions & 8 deletions fileHandling/folderManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
import tkinter.messagebox


source = r'C:\Users\rakesh\Documents'

filetype = {'docs': ['doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'txt', 'rtf', 'odf', 'odt'],
'pdf': ['pdf'],
'img': ['jpg', 'jpeg', 'png', 'gif', 'bmp'],
Expand All @@ -24,12 +22,12 @@

def filemove(file, filetype, key):
if(file.split('.')[1]) in filetype[key]:
if (os.path.exists(source+'/'+key) == False):
os.mkdir(source+'/'+key)
elif(path.isfile(source+'/'+key)):
os.mkdir(source+'/'+key)
if (os.path.exists(sourcedir+'/'+key) == False):
os.mkdir(sourcedir+'/'+key)
elif(path.isfile(sourcedir+'/'+key)):
os.mkdir(sourcedir+'/'+key)
try:
shutil.move(root + "/"+file, source+'/'+key)
shutil.move(sourcedir + "/"+file, sourcedir+'/'+key)
except:
pass

Expand All @@ -48,4 +46,4 @@ def filemove(file, filetype, key):
if(file.split('.')[1]) in filetype[key]:
filemove(file, filetype, key)

tkinter.messagebox.showinfo('Window Title', 'Please check your Folde now')
tkinter.messagebox.showinfo('Folder Manager', 'Please check your Folde now')
17 changes: 16 additions & 1 deletion functions/recursion/natutal_no.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,20 @@ def natural(n):
else:
print(n)
return natural(n-1)


def natural1(n):
if n == 100:
print(100)
return
else:
print(n)
return natural(n+1)
# function call to print 100 natural no


# function call to print 100 natural no
natural(100)

natural(1)
#natural(100)

2 changes: 0 additions & 2 deletions turtle.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import tkinter
from turtle import *
begin_fill()
while True:
forward(200)
left(170)
if abs(pos()) < 1:
break
end_fill()
done()


Expand Down

0 comments on commit 0c788d2

Please sign in to comment.