Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Challenge and Interview Charles lake #98

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions frontend.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!DOCTYPE html>
<html>
<head>
<title>
General Motor Company
</title>
<link rel="shortcut icon" type="image/png" href="favicon.png">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://www.google.com/recaptcha/api.js?render=6LdKcJgcAAAAAMqZgLiPXVdR7gyHHG_QHVxvBhV-"></script>
</head>

<body>
<h1>Contact Us</h1>
<form id="contact-form" onsubmit="onSubmit()">

<label for="fname">First Name</label><br>
<input type="text" id="fname" name="fname" value=""><br>
<label for="lname">Last Name</label><br>
<input type="text" id="lname" name="lname" value=""><br>
<label for="phonenum">Phone Number</label><br>
<input type="text" id="phonenum" name="phonenum" value=""><br>
<label for="email">Email</label><br>
<input type="text" id="email" name=email" value=""><br>


</form>
<script>
function onSubmit(token)
{
console.log("Results");
document.getElementById("contact-form").submit();
console.log("First Name:" + document.getElementById("fname").value);
console.log("Last Name:" + document.getElementById("lname").value);
console.log("Phone Number:" + document.getElementById("phonenum").value);
console.log("Email:" + document.getElementById("email").value);
}
</script>
<button type="submit" form="contact-form" value="submit">Submit</button>
</body>
</html>
25 changes: 25 additions & 0 deletions solveCharlesLake.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

def encode(l): #s is the input string

encoding = " " #ouput string for encode(l)

i = 0
while i < len(l):
# the number of same characters and a certain index
count = 1

while i + 1 < len(l) and l[i] == l[i + 1]:
count = count + 1
i = i + 1

# record the ammount of times a character is used and add it to hte output string
encoding += str(count) + l[i]
i = i + 1

return encoding


if __name__ == '__main__':

l = 'ttttbccaadrrrr'
print(encode(l))