From fd1d03d3271f1c5edb38ed4311266af0bbfad80e Mon Sep 17 00:00:00 2001 From: rakesh kumar Date: Tue, 17 Apr 2018 10:28:09 +0530 Subject: [PATCH] File handling folder added --- ExceptionHandling/tryExcept.py | 9 +++++++ delete_duplicate_files.py | 1 - fileHandling/abcd.txt | 47 ++++++++++++++++++++++++++++++++++ fileHandling/file_read.py | 4 +++ xxx.py | 0 5 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 ExceptionHandling/tryExcept.py create mode 100644 fileHandling/abcd.txt create mode 100644 fileHandling/file_read.py create mode 100644 xxx.py diff --git a/ExceptionHandling/tryExcept.py b/ExceptionHandling/tryExcept.py new file mode 100644 index 0000000..f5a7c54 --- /dev/null +++ b/ExceptionHandling/tryExcept.py @@ -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") \ No newline at end of file diff --git a/delete_duplicate_files.py b/delete_duplicate_files.py index da6421d..36c90d6 100644 --- a/delete_duplicate_files.py +++ b/delete_duplicate_files.py @@ -6,7 +6,6 @@ import glob import tkinter as tk from tkinter import filedialog - count=0 root = tk.Tk() root.withdraw() diff --git a/fileHandling/abcd.txt b/fileHandling/abcd.txt new file mode 100644 index 0000000..0f9388a --- /dev/null +++ b/fileHandling/abcd.txt @@ -0,0 +1,47 @@ +/* Program to Find the Largest & Smallest Word in a String + made by : rakesh kumar +*/ +#include +#include +#include +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 '"<