Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
Welcome back.
Let's try and do an exercise to tie everything that we've learned up until now.
Together we're going to create a password checker.
Now what we want to do is to create some sort of an input that we're going to ask.
So we're going to use the input function.
And here we're going to ask for a user name.
Then we're going to ask for another input.
It's going to be the password and then at the end with the input we want to print something the lines
of password and then we'll have maybe the actual password in here.
And it will say is another variable here long.
So what we want to do is the password and then maybe the password length so that let's say we printed
our user name JJ and then we give it a password of secret.
Well we should print the password.
Secret is 1 2 3 4 5 6 letters long.
Now obviously we all want to show or display the password maybe for security reasons.
So we want to convert this secret to 1 2 3 4 5 6 2 stars so your task is to convert these two and puts
And you know what.
Let's also do a greeting where we say the user name here.
So we're going to say Hey J.J. your password which will be marked in the star is 6 letters long.
Now one neat trick here that you haven't learned yet and you might want to use here is this.
They can do with strings.
I can go star times make sure that the star is a string.
Multiply it by 10.
And if I print this out
I get 10 stars.
So you may want to use this functionality when we're doing this.
All right.
Positive video.
Give it a go.
If you can remember the goal is to print the username and have the password blocked with how many characters
the password is.
All right.
Pause a video.
If not I'm going to get going with the answer so the first thing we're gonna try and do is I'm going
to create two inputs.
So the first one I'm going to get the user name going to assign into the variable user name.
And it's going to say what is your username.
Then the second one will be the password and the password.
Well we'll say what is your password and although this is a simple example this is something that you
will see with other big Web sites like Instagram or maybe Netflix when you're logging in.
So now that I've stored this information into a variable I can use it.
Right.
I can print and we'll do an F string to make our lives easier.
So I've added the F here.
And what we'll do is this will say user name your password and will add the password.
Here is and then we'll add another variable here which is the password length.
So how are we going to calculate that.
Well let's try something here.
Let's see if I can use the length function and in here.
Do password.
Let's see what happens here what is my username.
Let's go with Andre what is my password.
Let's just type in secret here.
I get Andre your password.
Well I can't speak English properly.
My password secret is 6 while 6 1.
That's right.
6 letters long awesome.
So this is working because with an F string I can create or add a python expression in here using the
length password.
But there's an issue here right.
We don't want to actually print out secret.
We want to print it out in these star form and this is a good discussion topping on readability of your
code.
Now this is a simple example but we can make this code a little bit cleaner.
For example we can break things down so that we'll have password length will be length password.
So we're calculating the length.
So this is going to store 6 or whatever the input of our password is.
And it's nice and descriptive.
It's easy for other developers to understand and then in here I can also have hidden password and this
hidden password will be the password length and we're going to use that star string and multiply it
by the password length.
Let's make this a little bit bigger so that now our code can be understood.
Well in an easier fashion.
So we have the password length so we're gonna say username your password password.
But we want to make sure that it's the hidden password so we'll copy this over here.
So username your password we're gonna print out hit and password is and then we're going to copy password
length.
Now I argue that this reads better because each line is doing something simple.
And then finally we're printing the output.
And although this is a small simple example this idea of readability and making and writing code that
makes sense.
Is an important concept.
So let's see if this works when you click on my username.
Andre.
This time around my password is going to be super secret and look at that Andre.
Your password did it it is eleven letters long.
Good job getting this far.
Hopefully you got that.
I'll see you in the next video.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.