From fc6ce02b1abbe53ef1b80859087e0156b820ba06 Mon Sep 17 00:00:00 2001 From: Arijit2003 <91794464+Arijit2003@users.noreply.github.com> Date: Mon, 1 Nov 2021 21:49:33 +0530 Subject: [PATCH] Add files via upload --- Lab exercise 2.py | 132 +++++++++++++++++++++++ circulating_in_a_list.py | 5 + classactivity.py | 91 ++++++++++++++++ classactivity2.py | 225 +++++++++++++++++++++++++++++++++++++++ experiment.py | 5 + function.py | 30 ++++++ functiondef.py | 4 + guessing game.py | 15 +++ guessing game2.py | 15 +++ hometask circulation.py | 12 +++ paractices.py | 179 +++++++++++++++++++++++++++++++ password validity.py | 30 ++++++ password validity2.py | 22 ++++ play.mp3 | Bin 0 -> 6912 bytes python.code-runner.txt | 2 + quiz.py | 2 + signsandsymbols.py | 46 ++++++++ swapping.py | 36 +++++++ test2.py | 10 ++ test3.py | 25 +++++ text_to_speech.py | 7 ++ text_to_speech2.py | 8 ++ trial and error.py | 20 ++++ trial.py | 42 ++++++++ trial1.py | 21 ++++ trial2.py | 16 +++ tuple_method.py | 21 ++++ 27 files changed, 1021 insertions(+) create mode 100644 Lab exercise 2.py create mode 100644 circulating_in_a_list.py create mode 100644 classactivity.py create mode 100644 classactivity2.py create mode 100644 experiment.py create mode 100644 function.py create mode 100644 functiondef.py create mode 100644 guessing game.py create mode 100644 guessing game2.py create mode 100644 hometask circulation.py create mode 100644 paractices.py create mode 100644 password validity.py create mode 100644 password validity2.py create mode 100644 play.mp3 create mode 100644 python.code-runner.txt create mode 100644 quiz.py create mode 100644 signsandsymbols.py create mode 100644 swapping.py create mode 100644 test2.py create mode 100644 test3.py create mode 100644 text_to_speech.py create mode 100644 text_to_speech2.py create mode 100644 trial and error.py create mode 100644 trial.py create mode 100644 trial1.py create mode 100644 trial2.py create mode 100644 tuple_method.py diff --git a/Lab exercise 2.py b/Lab exercise 2.py new file mode 100644 index 0000000..f29c70e --- /dev/null +++ b/Lab exercise 2.py @@ -0,0 +1,132 @@ +#1) +A=int(input("Enter RS:")) +D=A/74.73 +print(A,"in $ is",D) +def dollar_from_RS(B): + D=B/74.73 + return D +F=int(input("Enter RS:")) +print(dollar_from_RS(F)) + +def Rs_to_dollar(a): + dollar=a/74.73 + print(dollar) +r=int(input("Enter Rs:")) +Rs_to_dollar(r) +#2) +A=input("Enter Character:") +print("The ASCSII value",ord(A)) + +#3) +X=0 +Y=1 +while X<=100: + print(X) + (X,Y)=(Y,X+Y) + + +#4)Factorial +def factorial(A): + mul=1 + for X in range(1,A+1): + mul=mul*X + print("factorial of",A,"is",mul) +factorial(int(input("Enter any number:"))) +#Program on Control Flow (Conditional & Loops) +#1) +A=int(input("Enter Number:")) +i=0 +Sum=0 +for X in str(A): + W=int(X)*10**i + Sum=Sum+W + i=i+1 +print(Sum) +#2) + +A=int(input("Enter Number:")) +if A>0: + print("The number is positive.") +elif A<0: + print("The number is negative.") +else: + print("The number is",0) + + +#Program on Functions + + +#1) +def maximum(a,b,c): + if a>b and a>c: + print(a,"is the maximum") + elif b>a and b>c : + print(b,"is the maximum") + else: + print(c,"is the maximum") + +maximum(10,15,24) + +#2) +A=[1,2,3,4,5,6,78,9,8] +mul=1 +for X in A: + mul=mul*X +print(mul) + +#3) +def unique_list(a): + S=set((a)) + L=list((S)) + L.sort() + print(L) +unique_list([1,2,3,4,1,2,5,9,8,7,8]) + +#4) +def multiplication(): + a=int(input("Enter 1st number:")) + b=int(input("Enter 2nd number:")) + def multiplication2(c,d): + D=c*d + print(D) + multiplication2(a,b) +multiplication() + +#5) +def square(num): + D=num**2 + return D +def cube(num2): + J=num2**3 + return J +A=[1,2,3,4,5,6,7,8,9] +B=(1,20,3,40,54,6,79.9,8,9) +C={1,2.5,3,4,0.5,67.336,7,81,92} +print(list(map(square,A))) +print(set(map(cube,B))) +print(tuple(map(square,C))) +squ=lambda X:X**2 +cube1=lambda Y:Y**3 +print(list(map(cube1,A))) +print(tuple(map(squ,B))) + + + + + + + + + + + + + + + + + + + + + diff --git a/circulating_in_a_list.py b/circulating_in_a_list.py new file mode 100644 index 0000000..eaac202 --- /dev/null +++ b/circulating_in_a_list.py @@ -0,0 +1,5 @@ +def circulate(list,n): + print(list) + list=list[n:]+list[:n] + print(list) +circulate([1,2,3,4,5,6,7,8,9],-2) diff --git a/classactivity.py b/classactivity.py new file mode 100644 index 0000000..81a4d56 --- /dev/null +++ b/classactivity.py @@ -0,0 +1,91 @@ +#1) Write a Python program to count the number of even and odd numbers from a series of numbers. + +#Sample numbers : numbers = (1, 2, 3, 4, 5, 6, 7, 8, 9) + +numbers=(1,2,3,4,5,6,7,8,9) +count=0 +countf=0 +for X in numbers: + if X%2==0: + count+=1 + if X%2!=0: + countf+=1 +print("number of even numbers are",count) +print("number of odd numbers are",countf) + +#2) Write a Python program that prints all the numbers from 0 to 6 except 3 and 6. +for Y in range(0,7): + if Y==3 or Y==6: + continue + else: + print(Y) +#4)Create a list and find the largest element in a list using max() function by passing objects as arguments (numbers). +A=[1,2,3,4,5,6,7,8,9] +print(max(A)) + +#5). Print the sum of the given list. + +# my_list = [10,20,30,40,50,50,60,10] +my_list=[10,20,30,40,50,50,60,10] +print(sum(my_list)) + +#6)Python function to add two variables values with the following: +#i) with return +def addition(U,V): + S=U+V + return S +print(addition(5,9)) +#ii)without return +def addition2(D,F): + P=D+F + print(P) +addition2(10.464055,15.3259) + +#7)Find out the student’s grade from the marks obtained by the student. +a=int(input("Enter Your Obtained marks:")) +if a>=95: + print("Your Grade is A+") +elif a>=90: + print("Your Grade is A") +elif a>=85: + print("Your Grade is B+") +elif a>=70: + print("Your Grade is B") +elif a>=50: + print("Your Grade is C") +elif a>=45: + print("Your Grade is D") +else: + print("Fail") +#8)Compare two lists in Python and display the corresponding results. +W=[1,2,3,34,5,69,8,14] +Q=[2,1,34,14,8,3,5,69] +W.sort() +Q.sort() +if W==Q: + print("Compared lists are equal") +else: + print("Compared lists are not equal") + + + + + + + + + + + + + + + + + + + + + + + diff --git a/classactivity2.py b/classactivity2.py new file mode 100644 index 0000000..03a3325 --- /dev/null +++ b/classactivity2.py @@ -0,0 +1,225 @@ +# with argument with return +def addition(X,Y): + C=X+Y + return C +a=int(input("Enter 1st Number")) +b=int(input("Enter 2nd Number")) +print("addition is",addition(a,b)) +def substraction(U,V): + D=U-V + return D +a=int(input("Enter 1st Number")) +b=int(input("Enter 2nd Number")) +print("substraction is",substraction(a,b)) +def multiplication(X,Y): + C=X*Y + return C +a=int(input("Enter 1st Number")) +b=int(input("Enter 2nd Number")) +print("multiplication is",multiplication(a,b)) +def division(X,Y): + C=X/Y + return C +a=int(input("Enter 1st Number")) +b=int(input("Enter 2nd Number")) +print("division is",division(a,b)) +def floor_division(X,Y): + C=X//Y + return C +a=int(input("Enter 1st Number")) +b=int(input("Enter 2nd Number")) +print("floor division is",floor_division(a,b)) +def modulus(X,Y): + C=X%Y + return C +a=int(input("Enter 1st Number")) +b=int(input("Enter 2nd Number")) +print("remainder is",modulus(a,b)) + + +#without return with arguments +def addition(X,Y): + C=X+Y + print ("addition is",C) +a=int(input("Enter 1st Number")) +b=int(input("Enter 2nd Number")) +addition(a,b) +def substraction(U,V): + D=U-V + print("substraction is",D) +a=int(input("Enter 1st Number")) +b=int(input("Enter 2nd Number")) +substraction(a,b) +def multiplication(X,Y): + C=X*Y + print("multiplication is",C) +a=int(input("Enter 1st Number")) +b=int(input("Enter 2nd Number")) +multiplication(a,b) +def division(X,Y): + C=X/Y + print("division is",C) +a=int(input("Enter 1st Number")) +b=int(input("Enter 2nd Number")) +division(a,b) +def floor_division(X,Y): + C=X//Y + print("floor_division",C) +a=int(input("Enter 1st Number")) +b=int(input("Enter 2nd Number")) +addition(a,b) +def modulus(X,Y): + C=X%Y + print("remainder is",C) +a=int(input("Enter 1st Number")) +b=int(input("Enter 2nd Number")) +modulus(a,b) +#without argument without return + +def addition(): + X=int(input("Enter 1 st num:")) + Y=int(input("Enter 2nd num:")) + C=X+Y + print("addition is",C) +addition() +def substraction(): + U=int(input("Enter 1st Number")) + V=int(input("Enter 2nd Number")) + D=U-V + print("substraction",D) +addition() +def multiplication(): + X=int(input("Enter 1st Number")) + Y=int(input("Enter 2nd Number")) + C=X*Y + print("multiplication is",C) +multiplication() +def division(): + X=int(input("Enter 1st Number")) + Y=int(input("Enter 2nd Number")) + C=X/Y + print("division is",C) +division() +def floor_division(): + X=int(input("Enter 1st Number")) + Y=int(input("Enter 2nd Number")) + C=X//Y + print("floor_division",C) +floor_division() +def modulus(): + X=int(input("Enter 1st Number")) + Y=int(input("Enter 2nd Number")) + C=X%Y + print("remainder is",C) +modulus() +# without argument with return +def addition(): + X=int(input("Enter 1 st num:")) + Y=int(input("Enter 2nd num:")) + C=X+Y + return C +print("addition is",addition()) +def substraction(): + U=int(input("Enter 1st Number")) + V=int(input("Enter 2nd Number")) + D=U-V + return D +print("substraction is",substraction()) +def multiplication(): + X=int(input("Enter 1st Number")) + Y=int(input("Enter 2nd Number")) + C=X*Y + return C +ptrint("multiplication is",multiplication()) +def division(): + X=int(input("Enter 1st Number")) + Y=int(input("Enter 2nd Number")) + C=X/Y + return C +print("division is",division()) +def floor_division(): + X=int(input("Enter 1st Number")) + Y=int(input("Enter 2nd Number")) + C=X//Y + return C +print("floor division is",floor_division()) +def modulus(): + X=int(input("Enter 1st Number")) + Y=int(input("Enter 2nd Number")) + C=X%Y + return C +print("remainder is",modulus()) + +# Without Separate +#with argument with return +def calculator(G,H): + A=G+H + S=G-H + M=G*H + D=G/H + FD=G//H + REMAINDER=G%H + return A,S,M,D,FD,REMAINDER +a=float(input("Enter 1st num:")) +b=float(input("Enter 2nd num:")) +print(calculator(a,b)) + +# with argument without return +def calculator_2 (P,Q): + print("Addition is",P+Q) + print("Substraction",P-Q) + print("Multiplication is",P*Q) + print("Division is",P/Q) + print("Floor division is",P//Q) + print("Remainder is",P%Q) +a=int(input("Enter 1st num:")) +b=int(intput("Enter 2nd num:")) +calculator_2(a,b) + +#without argument with return + +def calculator_3(): + G=int(input("Enter 1st num:")) + H=int(input("Enter 2nd num:")) + A=G+H + S=G-H + M=G*H + D=G/H + FD=G//H + REMAINDER=G%H + return A,S,M,D,FD,REMAINDER +print(calculator_3()) + +#without argument without return + + +def calculator_4(): + P=int(input("Enter 1st num:")) + Q=int(input("Enter 2nd num:")) + print("Addition is",P+Q) + print("Substraction",P-Q) + print("Multiplication is",P*Q) + print("Division is",P/Q) + print("Floor division is",P//Q) + print("Remainder is",P%Q) +calculator_4() + + + + + + + + + + + + + + + + + + + + diff --git a/experiment.py b/experiment.py new file mode 100644 index 0000000..deb0dbb --- /dev/null +++ b/experiment.py @@ -0,0 +1,5 @@ +for Y in range(0,7): + if Y==3 or Y==6: + continue + else: + print(Y) diff --git a/function.py b/function.py new file mode 100644 index 0000000..e39bf22 --- /dev/null +++ b/function.py @@ -0,0 +1,30 @@ +def addition(a,b): + c=a+b + print(c) +addition(5,10) + +def subtraction(d,e): + f=d+e + print(f) +subtraction(4,8) +def multiplication(g,h): + z=g*h + print(z) +multiplication(2,5) +def division(k,l): + x=k/l + print(x) +division(6,3) +def power(a,b): + c=a**b + print(c) +power(2,5) +def floor_division(a,b): + c=a//b + print(c) +floor_division(5,2) +def remainder (a,b): + c=a%b + print(c) +remainder(5,2) + diff --git a/functiondef.py b/functiondef.py new file mode 100644 index 0000000..328833f --- /dev/null +++ b/functiondef.py @@ -0,0 +1,4 @@ +student("Arijit","Debadersha") +def student(*name): + print(name) + diff --git a/guessing game.py b/guessing game.py new file mode 100644 index 0000000..a3fb175 --- /dev/null +++ b/guessing game.py @@ -0,0 +1,15 @@ +import random +A=random.randrange(1,99) +D=int(input("Enter Number:")) +guesses=1 +while guesses<10 and D!=A: + guesses+=1 + if D>A: + print("you have guessed a wrong number and the number is bigger than the actual number") + else: + print("You have guessed a wrong number and the number is smaller than the actual number ") + D=int(input("Guesses again")) +if D==A: + print("You have guessed the number in",guesses,"guesses") +else: + print("You lose the game") diff --git a/guessing game2.py b/guessing game2.py new file mode 100644 index 0000000..6d2a425 --- /dev/null +++ b/guessing game2.py @@ -0,0 +1,15 @@ +import random +A=random.randrange(1,100) +I=int(input("Guess the number?:")) +Guesses=1 +while I!=A and Guesses<=10: + if I> A: + print("THe number you guessed is higher than the actual guessing number") + else: + print("The number you guessed is smaller than the actual guessing number") + I=int(input("Guess Again")) + Guesses+=1 +if I==A: + print("You have guessed the wright number in",Guesses,"guesses") +else: + print("You lose the game") diff --git a/hometask circulation.py b/hometask circulation.py new file mode 100644 index 0000000..184488a --- /dev/null +++ b/hometask circulation.py @@ -0,0 +1,12 @@ +def circulation(list,n): + print(list) + print("left circulation by 3") + list=list[n:]+list[:n] + print(list) +circulation([1,2,True,2.5,"Hero",[3,4,56,58],("a","b","c"),{100,200,300},{"cars":"tesla","fruit":"mango"}],3) +def circulation1(A,B): + print(A) + print("right circulation by 3") + A=A[B:]+A[:B] + print(A) +circulation1([1,2,True,2.5,"Hero",[3,4,56,58],("a","b","c"),{100,200,300},{"cars":"tesla","fruit":"mango"}],-3) diff --git a/paractices.py b/paractices.py new file mode 100644 index 0000000..294101b --- /dev/null +++ b/paractices.py @@ -0,0 +1,179 @@ +A=input("Enter any word:") +print(A[::-1]) +#1) using third variable +C=int(input("Enter 1st number:")) +D=int(input("Enter 2nd number:")) +print("Before swapping",C) +print("Before Swapping",D) +temp=C +C=D +D=temp +print("After swapping",C) +print("After swapping",D) +#2) using tuple assignment +E=int(input("Enter 1st number:")) +F=int(input("Enter 2nd number:")) +print("Before swapping",E) +print("Before Swapping",F) +(E,F)=(F,E) +print("After Swapping",E) +print("After swapping",F) +#3) Arithmetic operators +#using + and - +G=int(input("Enter 1st number:")) +H=int(input("Enter 2nd number:")) +print("Before Swapping",G) +print("Before Swapping",H) +G=G+H +H=G-H +G=G-H +print("After Swapping",G) +print("After Swapping",H) +# using * and / +I=int(input("Enter 1st number:")) +J=int(input("Enter 2nd number:")) +print("Before Swapping",I) +print("Before Swapping",J) +I=I*J +J=I/J +I=I/J +print("After Swapping",I) +print("After Swapping",J) +#4)using Bitwise operator +# Bitwise XOR (^) +K=int(input("Enter 1st num:")) +L=int(input("Enter 2nd numb:")) +print("Before swapping",E) +print("Before Swapping",F) +K=K^L +L=K^L +K=K^L +print("After Swapping",K) +print("After Swapping",L) +Sum=0 +j=True +i=0 +while j==True: + i=i+1 + if i<=4: + j=True + A=int(input("Enter Num:")) + Sum=Sum+A + else: + j=False +print(Sum) +if Sum>100: + print("Yes its greater than 100") +else: + print("Its not greater than 100") + + +i=0 +while True and i<4: + i+=1 + A=int(input("Enter num1:")) + if A>100: + continue + print(A) + + +i=0 +while True: + i=i+1 + if i>10: + break + else: + print(i) +A=[1,2,3,4,5,6,7] +for X in A: + if X==7: + continue + else: + print(X) + +for X in A: + if X==6: + break + else: + print(X) + +A=[1,2,3,4,5,6,6,4,7,8] +i=0 +while i<=len(A)-1: + for X in A: + if A.index(X)==i: + continue + elif A[i]==X: + print(X,"is the duplicate member") + break + i=i+1 + +count=1 +i=0 +while i<=len(A)-1: + for X in A: + if A.index(X)==i: + continue + elif A[i]==X: + count=count+1 + print(A[i],"is repeated",count,"times") + i=i+1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/password validity.py b/password validity.py new file mode 100644 index 0000000..a72d479 --- /dev/null +++ b/password validity.py @@ -0,0 +1,30 @@ +i=0 +while i<5: + U=False + L=False + D=False + S=False + A=input("Enter Strong Password:") + if len(A)>6 or len(A)<16: + for X in A: + if X.isupper(): + U=True + if X.islower(): + L=True + if X.isdigit(): + D=True + if X=="@" or X=="#" or X=="$": + S=True + if U==True and L==True and D==True and S==True: + print("Your password is strong") + break + else: + print("Invalid Password") + else: + print("Your Password must contain 6-16 characters") + i=i+1 + + + + + diff --git a/password validity2.py b/password validity2.py new file mode 100644 index 0000000..dbc3b6a --- /dev/null +++ b/password validity2.py @@ -0,0 +1,22 @@ +import re +T=True +while T: + A=input("Enter strong Password:") + if not len(A)>6 and not len(A)<16: + print("Invalid Password 1") + continue + if not re.search("[a-z]",A): + print("Invalid password 2") + continue + if not re.search("[A-Z]",A): + print("Invalid Password 3") + continue + if not re.search("[0-9]",A): + print("Invalid Password 4") + continue + if not re.search("[@#$]",A): + print("Invalid Password 5") + continue + else: + print("Your have succesfully created a strong password.") + break diff --git a/play.mp3 b/play.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..f078f0e42600e8a00e2fb452a416b88eb441c5b7 GIT binary patch literal 6912 zcmb`~byQSc+c5AmlrR!ABOoOLA|RoZG}7I9lY)fIO*aA}LxVI7B^@F|gEZ2JlprY~ zsdOob^qiORUGKBj_xJZ)f1R0i=69}r?S0MO2RxGR1>l_umk<>gKnW!zhzjeZ!N<3> zgi-QE7dmZ|s^Tx7KA`}?OHGPkNKBs9`%|WaU`YIaWzV*gE}AfGGhpgK`xO|H)8g^2L_zyte+A%ltcbQKb%~-tKx|=-b>|H{~WAy8#bJGOCPcj0Er%B)u*VZ0=G6SGvSU8oZ+9&+zD&L@NSKXn8alQ>4@ek&99m8ly+1qf}on8LCjh4V?_ zHJVM32@XKnmHD`166`p++&QW#(TC$_`5DLg(T1#|_HD!%6`xH)8=eBO^S~hI*ZCW!TVOW?L9lKSd%xTaq;N2?4;b{?P2^{?^yE&Z zE!b9`q;UBpRRD^geh2M3&U5BWxMz9!uGyc`(N z&fs8SNwV*u%W_53h!xDf`gJk;O3H&q0@Q6(unADrlZ1Y>h95nUkF%ESMfJ!P`^Ddx zyo{;t+9rx7@x5;YP*crV;w>*Hbp|CH10kbyo&!O{INub`teOBZ;Q$OtM^K^W=(%a`*zyl%3w`VVBFmH(vQv!Ss(-us zSw?NTdeJ^}x{AfZ9jr!sbDT^tayb8AX7>V1NTw0+?by`cys^q+o6+xn?7w|=`{W;G zdwVgI&ZT*l|Aw#rq|`WbEjr0y5cGCc+nG{VP!$cr66nYyS|rINp@p? zQNt*I$`*Dnr#}UY^M&r#ZkI#Sr6Ih3xED30JM-L>PqdI6!Rz@Py^NwOD{pqvewY2c z!h8(tDTFiyM0WiYVm0_J)?gqUt)_K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F4O$~?pQnE&%vR#uh)0FU!w z7b89|ZO|}XKKX6tZGg!pRWLGApOf;niZ%-4cs)Eb11R3#=$yEuB9yU2(vgF!Oh`JS zpalJcNz&lF5>6kmH?LZd4Cj~spU>DU{YB89C@4>#iqQVLc>iDZ`rqHXH2=7sU-kcd``^3xf9mt!WB()l53<(9#Q*>R literal 0 HcmV?d00001 diff --git a/python.code-runner.txt b/python.code-runner.txt new file mode 100644 index 0000000..71f1ca1 --- /dev/null +++ b/python.code-runner.txt @@ -0,0 +1,2 @@ +python +A=2+5 diff --git a/quiz.py b/quiz.py new file mode 100644 index 0000000..32aa843 --- /dev/null +++ b/quiz.py @@ -0,0 +1,2 @@ +print("The sum of {0} and {1} is {2}".format((2,10,12)) +) diff --git a/signsandsymbols.py b/signsandsymbols.py new file mode 100644 index 0000000..1cbad66 --- /dev/null +++ b/signsandsymbols.py @@ -0,0 +1,46 @@ +print(4*"*") +i=0 +while i<=10: + print(i*"*") + i+=1 + +j=10 +while j>0: + print(j*"*") + j=j-1 + + +l=int(input("Enter no.")) +b=1 +X=l*" * " +while b16: + print("Your password must be within 6-16 characters") + print("Create again") + continue + if not re.search("[a-z]",A): + print("Invalid Password") + print("Create again") + continue + if not re.search("[A-Z]",A): + print("Invalid Password") + print("Create again") + continue + if not re.search("[0-9]",A): + print("Invalid Password") + print("Create again") + continue + if not re.search("[@#$]",A): + print("Invalid Password) + print("Create again") + continue + else: + print("Its a strong password") + break diff --git a/swapping.py b/swapping.py new file mode 100644 index 0000000..4205d34 --- /dev/null +++ b/swapping.py @@ -0,0 +1,36 @@ +#swapping using third variable +A=int(input("Enter 1 st number:")) +B=int(input("Enter 2 nd number:")) +print("befpore swapping",A,B) +temp=A +A=B +B=temp +print("after swapping",A,B) +#swapping using arithmetic operators +X=int(input("Enter 1 st number:")) +Y=int(input("Enter 2nd number:")) +print("before swapping",X,Y) +(X,Y)=(Y,X) +print("after swapping",X,Y) +W=int(input("Enter 1st number:")) +D=int(input("Enter 2nd number:")) +print("before swapping",W,D) +W=W-D +D=W+D +W=D-W +print("after swapping",W,D) +P=int(input("Enter 1st nmber:")) +Q=int(input("Enter 2nd number:")) +print("before swapping",P,Q) +P=P*Q +Q=P/Q +P=P/Q +print("after swapping",P,Q) +#swapping using bitwise operator(XOR) +E=int(input("Enter 1st number:")) +F=int(input("Enter 2nd number:")) +print("before swapping",E,F) +F=E^F +E=E^F +F=E^F +print("after swapping",E,F) diff --git a/test2.py b/test2.py new file mode 100644 index 0000000..7b3fce6 --- /dev/null +++ b/test2.py @@ -0,0 +1,10 @@ +var = 11 +while var>0: + var = var - 1 + if var == 5: + continue + print("The current variable is: ",var) + +print("End!") + + diff --git a/test3.py b/test3.py new file mode 100644 index 0000000..96b9524 --- /dev/null +++ b/test3.py @@ -0,0 +1,25 @@ +A=[1,2,3,4,5,6,6,4,7,8,3] +i=0 +while i<=len(A)-1: + for X in A: + if A.index(X)==i: + continue + elif A[i]==X: + print(X,"is the duplicate member") + break + i=i+1 + +A=[1,2,3,4,5,6,4,8,1,7,8,9,9,5,2] +S=[] +for i in A: + if i not in S: + S.append(i) + else: + print("duplicate members are",i) +N=[1,2,3,4,5,6] +def LIST(a,n): + a=a[n:]+a[:n] + print(a) +LIST([1,2,"a","b",3,4,"c","d"],2) + + diff --git a/text_to_speech.py b/text_to_speech.py new file mode 100644 index 0000000..b44bffd --- /dev/null +++ b/text_to_speech.py @@ -0,0 +1,7 @@ +from gtts import gTTS +import os +text1=input("Enter text to speech:") +language="en" +sound=gTTS(text=text1,lang=language,slow=False) +sound.save("play.mp3") +os.system("start play.mp3") diff --git a/text_to_speech2.py b/text_to_speech2.py new file mode 100644 index 0000000..2f47e20 --- /dev/null +++ b/text_to_speech2.py @@ -0,0 +1,8 @@ +import pyttsx3 +engine = pyttsx3.init() +voices = engine.getProperty("voices") +engine.setProperty("voice",voices[0].id) +#print(voices[0].id) +engine.setProperty("rate",150) +engine.say("Hello how are you") +engine.runAndWait() \ No newline at end of file diff --git a/trial and error.py b/trial and error.py new file mode 100644 index 0000000..059ae0c --- /dev/null +++ b/trial and error.py @@ -0,0 +1,20 @@ +A={"1","2","3","4","5","6","7","8","9"} +B={"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"} +C={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"} +D={"@","#","$"} +W=input("Enter pqassword:") +if len(W) in range(6,17): + for X in W: + E=set((X)) + if E.issubset(A) or E.issubset(B) or E.issubset(C) or E.issubset(D:) + continue + + else: + break + + + + + + + diff --git a/trial.py b/trial.py new file mode 100644 index 0000000..1452855 --- /dev/null +++ b/trial.py @@ -0,0 +1,42 @@ +#def maximum(a,b,c): +# if a>b and a>c: +# return a +# elif b>a and b>c: +# return b +# else: +# return c +#print(maximum(1,15,14)) +# +#def multiplication(): +# a=int(input("Enter 1st number:")) +# b=int(input("Enter 2nd number:")) +# def multiplication2(c,d): +# D=c*d +# print(D) +# multiplication2(a,b) +#multiplication() +#def even_or_not(num): +# if num%2==0: +# print(num,"is even") +# else: +# print(num,"is odd") +#A=[1,2,3,4,5,6] +#tuple(map(even_or_not,A)) +def square(num): + D=num**2 + return D +def cube(num2): + J=num2**3 + return J +A=[1,2,3,4,5,6,7,8,9] +B=(1,20,3,40,54,6,79.9,8,9) +C={1,2.5,3,4,0.5,67.336,7,81,92} +print(list(map(square,A))) +print(set(map(cube,B))) +print(tuple(map(square,C))) +squ=lambda X:X**2 +#W=squ(10) +#print(W) +cube1=lambda Y:Y**3 +print(list(map(cube1,A))) +print(tuple(map(squ,B))) diff --git a/trial1.py b/trial1.py new file mode 100644 index 0000000..460c6b0 --- /dev/null +++ b/trial1.py @@ -0,0 +1,21 @@ +A=[1,2,3,4,5,6,4,5,6,6,4] +B=[] +C=[] +for X in A: + if X not in B: + B.append(X) + else: + C.append(X) +D=set(C) +E=list(D) +E.sort() +for G in E: + print("Duplicate members are",G) +for Z in E: + count=0 + for ele in A: + if ele==Z: + count+=1 + print(Z,"occurs in the list",count,"times") + + diff --git a/trial2.py b/trial2.py new file mode 100644 index 0000000..5091fbe --- /dev/null +++ b/trial2.py @@ -0,0 +1,16 @@ +def square(num): + D=num**2 + return D +def cube(num2): + J=num2**3 + return J +A=[1,2,3,4,5,6,7,8,9] +B=(1,20,3,40,54,6,79.9,8,9) +C={1,2.5,3,4,0.5,67.336,7,81,92} +print(list(map(square,A))) +print(set(map(cube,B))) +print(tuple(map(square,C))) +squ=lambda X:X**2 +cube1=lambda Y:Y**3 +print(list(map(cube1,A))) +print(tuple(map(squ,B))) diff --git a/tuple_method.py b/tuple_method.py new file mode 100644 index 0000000..771c6b3 --- /dev/null +++ b/tuple_method.py @@ -0,0 +1,21 @@ +A=(1,3,3,4,6,48,9,4) +print(A) +B=tuple([2,"arijit",True,bin(10),2.5]) +print(B) +A=A+(5,) +print(A) +A=A+tuple([20,30,]) +print(A) +A=A+B +print(A) +print(A.count(3)) +print(A.index(3)) +X=len(A)-1 +while X>=0: + if A[X]==3: + print(X) + X=X-1 +del A +print(A) + +