This repository contains the practice files used throughout the courses that are part of the Google IT Automation with Python Professional Certificate
There's a separate folder for each course.
Google IT Automation with Python Professional Certificate - Practice files
License: Apache License 2.0
.blue.kale
output = False
.blue.kale
output = True
Return false if usernames starts with "." or "_".
The script is returning True in those situations.
Blablla
Return False when username begins with non-alphabetical characters.
Return True when username begins with non-alphabetical characters.
fixed the behavior of validate_user function in validations.py
Closes #1258
The validations.py
file in Course3/Lab4
includes a validate_user
function. This function was recently modified to allow usernames to contain dots and underscores as well as letters and numbers.
The code currently validates that the first character of the username is not a number, and that was fine when only letters and numbers were allowed. Back when only letters and numbers were allowed, this meant that the username had to start with a letter. Now that we allow dots and underscores as well, we need to change the check of the first character as only letters are allowed in the first character of the username.
validate_user("blue.kale", 3)
-> Truevalidate_user(".blue.kale", 3)
-> Currently True, should be Falsevalidate_user("red_quinoa", 4)
-> Truevalidate_user("_red_quinoa", 4)
-> Currently True, should be Falsereturn False when forbidden characters in front of the text
return True whenever forbidden characters in front of the text or not
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).
๐ Please visit https://cla.developers.google.com/ to sign.
Once you've signed (or fixed any issues), please reply here with @googlebot I signed it!
and we'll verify it.
โน๏ธ Googlers: Go here for more info.
Originally posted by @google-cla in #7988 (comment)
print(validate_user("blue.kale", 3)) # True
print(validate_user(".blue.kale", 3)) # True
print(validate_user("red_quinoa", 4)) # True
print(validate_user("_red_quinoa", 4)) # True
print(validate_user("blue.kale", 3)) # True
print(validate_user(".blue.kale", 3)) # False
print(validate_user("red_quinoa", 4)) # True
print(validate_user("_red_quinoa", 4)) # False
just for a test
The validations.py file in Course3/Lab4 includes a validate_user function.
The code currently validates that the first character of the username is not a number. We need to check if usernames are all lower case and that they don't contain any spaces. Return False if they contain capital letters or spaces.
Examples:
validate_user("John.Haha", 3) -> False
validate_user(".green. kale", 3) -> False
validate_user("mark_smith", 4) -> True
validate_user("_Dr Who", 4) - > False
Returns False if the first letter of the username is not a letter in lowercase
Returns True when the first letter of the username is not a letter
Expect to run a script setup_puppet.sh
from the cloned repo mentioned in (Course5/Week3 > Video: Customizing VMs in GCP > time: 5:39)
~/it-cert-automation-practice/Course5/Lab3$ ./setup_puppet.sh
-bash: ./setup_puppet.sh: No such file or directory
~/it-cert-automation-practice/Course5/Lab3$
True
False
True
False
True
True
True
True
True
False
True
False
True
True
True
True
updated the validations.py
True
False
True
False
True
True
True
True
validate_user(".blue.kale", 3) -> should be False
validate_user("_red_quinoa", 4) -> should be False
validate_user(".blue.kale", 3) -> previously returning True
validate_user("_red_quinoa", 4) -> previously returning True
Return False when username begins with non-alphabetical characters.
Return True when username begins with non-alphabetical characters.
1.print(validate_user(".blue.kale", 3))
2.print(validate_user("_red_quinoa", 4))
There should be a testcases.py in the Course3
No test cases added
validate_user
function by using following line:-from validations import validate_user
True
False
True
False
True
True
True
True
Return False when invalid username is passed
Returns True for username that starts with a number, dot, or underscore
The username must consist of letters, numbers, dots and underscores.
It must start with only a letter and be at least 1 character long.
Code should be more fast and short and mordenize.
Code is not that fast.
in
Making code more modernized and efficient by using nested if-else statements.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.