Skip to content

Commit

Permalink
File handling folder added
Browse files Browse the repository at this point in the history
  • Loading branch information
rakeshlinux committed Apr 17, 2018
1 parent 497ba43 commit fd1d03d
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 1 deletion.
9 changes: 9 additions & 0 deletions ExceptionHandling/tryExcept.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
try:
a = 10
b = int(input("Enter any number "))
c = a/b
print(c)
except:
print('Can not divide number by ZERO')
else:
print("You are able to divide 10 by your inputed number")
1 change: 0 additions & 1 deletion delete_duplicate_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import glob
import tkinter as tk
from tkinter import filedialog

count=0
root = tk.Tk()
root.withdraw()
Expand Down
47 changes: 47 additions & 0 deletions fileHandling/abcd.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/* Program to Find the Largest & Smallest Word in a String
made by : rakesh kumar
*/
#include <iostream>
#include <string.h>
#include <ctype.h>
using namespace std;
int main()
{
char string[100], word[20], max[20], min[20], c;
int i = 0, j = 0, flag = 0;
cout<<"Enter string: ";
cin.getline(string,100);

//processing phase
for (i = 0; i < strlen(string); i++)
{
while (i < strlen(string) && !isspace(string[i]) && isalnum(string[i]))
{
word[j++] = string[i++];
}
if (j != 0)
{
word[j] = '\0';

if (flag==0) // this will run only once
{
flag = 1;
strcpy(max, word);
strcpy(min, word);
}
if (strlen(word) > strlen(max))
{
strcpy(max, word);
}
if (strlen(word) < strlen(min))
{
strcpy(min, word);
}
j = 0; // for next word in the string
}
}

//output phase
cout<<"The largest word is '"<<max <<"' and smallest word is '"<<min<<"' in ''"<<string<<"'";
return 0;
}
4 changes: 4 additions & 0 deletions fileHandling/file_read.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
file = open(r"C:\Users\acer\Desktop\pythonPrograms\fileHandling\abcd.txt",'r')
data1 = file.read()
print(data1)
file.close()
Empty file added xxx.py
Empty file.

0 comments on commit fd1d03d

Please sign in to comment.