diff --git a/PracticalFileQuestion/Q16.py b/PracticalFileQuestion/Q16.py index dee61b9..2af8693 100644 --- a/PracticalFileQuestion/Q16.py +++ b/PracticalFileQuestion/Q16.py @@ -6,7 +6,7 @@ def line_count(): for line in file.readlines(): if line[0]=='P' or line[0]=='S': count+=1 - print(line) + #print(line) file.close() print('Total lines :',count) diff --git a/PracticalFileQuestion/binary.dat b/PracticalFileQuestion/binary.dat index f85a0cc..21ad4d3 100644 Binary files a/PracticalFileQuestion/binary.dat and b/PracticalFileQuestion/binary.dat differ diff --git a/PracticalFileQuestion/list_reverse.py b/PracticalFileQuestion/list_reverse.py new file mode 100644 index 0000000..1997082 --- /dev/null +++ b/PracticalFileQuestion/list_reverse.py @@ -0,0 +1,3 @@ +list1 =['rakesh','is','a','good','boy'] +list2= list1[-1:0:-1] +print(list2) \ No newline at end of file diff --git a/PracticalFileQuestion/reverse_text.py b/PracticalFileQuestion/reverse_text.py new file mode 100644 index 0000000..d38d029 --- /dev/null +++ b/PracticalFileQuestion/reverse_text.py @@ -0,0 +1,5 @@ +file = open('C:/python/PracticalFileQuestion/diary.txt', 'r') +data = file.read().split() +for x in data[-1:0:-1]: + print(x[-1::-1], end=' ') +file.close() diff --git a/PracticalFileQuestion/student.csv b/PracticalFileQuestion/student.csv index 04f615b..aa819ab 100644 --- a/PracticalFileQuestion/student.csv +++ b/PracticalFileQuestion/student.csv @@ -2,3 +2,4 @@ 2,anmol,11 3,subodh,10 4,ravi,10 +6,govind,20 diff --git a/PracticalFileQuestion/tempCodeRunnerFile.py b/PracticalFileQuestion/tempCodeRunnerFile.py index da7f696..293ef5e 100644 --- a/PracticalFileQuestion/tempCodeRunnerFile.py +++ b/PracticalFileQuestion/tempCodeRunnerFile.py @@ -1 +1,5 @@ - temp = list1[i] \ No newline at end of file +file = open('C:/python/PracticalFileQuestion/diary.txt', 'r') +data = file.read().split() +for x in data[-1:0:-1]: + print(x[-1::-1], end=' ') +file.close() \ No newline at end of file diff --git a/Projects/md5_generator.py b/Projects/md5_generator.py new file mode 100644 index 0000000..ac201e6 --- /dev/null +++ b/Projects/md5_generator.py @@ -0,0 +1,11 @@ +import hashlib +import base64 + +text = 'This is me and this is my forst attempt in md5' +md_result = hashlib.md5(text.encode()) +base64_result = base64.b64encode(text.encode()) +sha384_result = hashlib.sha384(text.encode()) + +print(md_result.hexdigest()) +print(base64_result.hex()) +print(sha384_result.hexdigest()) diff --git a/opencv_project/capture_camera.py b/opencv_project/capture_camera.py new file mode 100644 index 0000000..53c7215 --- /dev/null +++ b/opencv_project/capture_camera.py @@ -0,0 +1,9 @@ +import cv2 +capture = cv2.VideoCapture(1) + +while True: + ret, frame = capture.read(1) + cv2.imshow('image',frame) + if cv2.waitKey(1) & 0xFF==ord('q'): + break +capture.release() \ No newline at end of file diff --git a/opencv_project/draw_shapes.py b/opencv_project/draw_shapes.py new file mode 100644 index 0000000..c7b8972 --- /dev/null +++ b/opencv_project/draw_shapes.py @@ -0,0 +1,10 @@ +import cv2 +image = cv2.imread('walter.jpg',1) +cv2.line(image,(0,0),(400,400),(255,0,0),5) +cv2.rectangle(image,(100,200),(400,400),(0,255,0),10) +cv2.circle(image,(200,200),100,(0,0,255),-8) +font = cv2.FONT_HERSHEY_COMPLEX +cv2.putText(image,'Hello rakesh',(150,250),font,2,(255,255,0),cv2.LINE_8) +cv2.imshow('image',image) +cv2.waitKey(0) +cv2.destroyAllWindows() \ No newline at end of file diff --git a/opencv_project/manipulating_pixel.py b/opencv_project/manipulating_pixel.py new file mode 100644 index 0000000..a8b20db --- /dev/null +++ b/opencv_project/manipulating_pixel.py @@ -0,0 +1,4 @@ +import cv2 + +image =cv2.imread('walter.jpg',1) +print(image) \ No newline at end of file diff --git a/opencv_project/mouse_event.py b/opencv_project/mouse_event.py new file mode 100644 index 0000000..3a29265 --- /dev/null +++ b/opencv_project/mouse_event.py @@ -0,0 +1,15 @@ +import cv2 + +def draw_circle(event,x,y,flag,param): + if event ==cv2.EVENT_LBUTTONDBLCLK : + cv2.circle(image,(x,y),100,(255,0,0),-1) + +image = cv2.imread('walter.jpg',1) +cv2.namedWindow('image') +cv2.setMouseCallback('image',draw_circle) + +while True: + cv2.imshow('image',image) + if cv2.waitKey(20) & 0xFF==27: + break +cv2.destroyAllWindows() diff --git a/opencv_project/read_image.py b/opencv_project/read_image.py new file mode 100644 index 0000000..4442ffe --- /dev/null +++ b/opencv_project/read_image.py @@ -0,0 +1,7 @@ +import cv2 + +image = cv2.imread('walter.jpg',1) +cv2.imshow('windows',image) +cv2.waitKey(3000) +cv2.imwrite('walter-1.png',image) +cv2.destroyAllWindows() \ No newline at end of file diff --git a/walter-1.png b/walter-1.png new file mode 100644 index 0000000..27574e9 Binary files /dev/null and b/walter-1.png differ diff --git a/12volt-watermarked.jpg b/walter.jpg similarity index 100% rename from 12volt-watermarked.jpg rename to walter.jpg