Skip to content

Instantly share code, notes, and snippets.

@Sef2022
Sef2022 / robot.py
Created July 1, 2022 02:38 — forked from solen003/robot.py
A robot moves in a plane starting from the original point (0,0). The robot can move toward UP, DOWN, LEFT and RIGHT with a given steps. The trace of robot movement is shown as the following: UP 5 DOWN 3 LEFT 3 RIGHT 2 ¡­ The numbers after the direction are steps. Please write a program to compute the distance from current position after a sequen…
import math
x, y = 0, 0
while True:
step = input("Type in UP/DOWN/LEFT/RIGHT #step number: ")
if step == "":
break
@Sef2022
Sef2022 / password_checker.py
Created June 29, 2022 21:04 — forked from solen003/password_checker.py
A website requires the users to input username and password to register. Write a program to check the validity of password input by users. Following are the criteria for checking the password: 1. At least 1 letter between [a-z] 2. At least 1 number between [0-9] 1. At least 1 letter between [A-Z] 3. At least 1 character from [$#@] 4. Minimum len…
import re
passwords = input("Type in: ")
passwords = passwords.split(",")
accepted_pass = []
for i in passwords:
if len(i) < 6 or len(i) > 12:
continue