From 44fbf2ba52d9a4b72c91e494d20739ab5602716e Mon Sep 17 00:00:00 2001 From: Your Full Name Date: Wed, 14 Feb 2024 00:37:34 +0530 Subject: [PATCH 1/3] Add files --- payment.py | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 payment.py diff --git a/payment.py b/payment.py new file mode 100644 index 0000000..a7f5ff7 --- /dev/null +++ b/payment.py @@ -0,0 +1,45 @@ +import random + + +# function to generate +# a random string +def generateOne(strlen): + + # string with all the alphabets + # and a space + alphabet = "abcdefghijklmnopqrstuvwxyz " + res ="" + + for i in range(strlen): + res+= alphabet[random.randrange(27)] + + return res + +# function to determine the +# score of the generated string +def score(goal, testString): + numSame = 0 + + for i in range(len(goal)): + if goal[i] == testString[i]: + numSame+= 1 + + return numSame / len(goal) + +# main function to call the previous +# two functions until the goal is achieved +def main(): + goalString = "a computer science portal for geeks" + newString = generateOne(35) + best = 0 + newScore = score(goalString, newString) + + while newScore<1: + if newScore>best: + print(newString) + best = newScore + newString = generateOne(35) + newScore = score(goalString, newString) + +# Driver code +main() From b368f2756bd4fcd4728feb8bce4674e5c21cfe9f Mon Sep 17 00:00:00 2001 From: Your Full Name Date: Wed, 14 Feb 2024 01:43:11 +0530 Subject: [PATCH 2/3] File uploaded --- .vscode/settings.json | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..0db5873 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "cmake.configureOnOpen": true +} \ No newline at end of file From efdbb968220d72dad40d8eccb0176b7caad48dbe Mon Sep 17 00:00:00 2001 From: saurav-suman7 <159948418+saurav-suman7@users.noreply.github.com> Date: Wed, 14 Feb 2024 02:05:13 +0530 Subject: [PATCH 3/3] updated --- .gitattributes | 2 ++ .vscode/settings.json | 3 +++ 2 files changed, 5 insertions(+) create mode 100644 .gitattributes create mode 100644 .vscode/settings.json diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..dfe0770 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..0db5873 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "cmake.configureOnOpen": true +} \ No newline at end of file