info1 = print("your username has to be between 3 and 12 characters long!") info2 = print("your username cant contain spaces and digits!") username = input("Please enter your username: ") if username.isdigit() or not username.isalpha(): print(f"{username} is not a valid username!") elif len(username) = 13: print(f"{username} is not a valid username!") else: print(f"Welcome {username}!!!") this is how I did it, thx for the tutorials man I used .isalpha to check for spaces:)
@@enespinar9711 i quit and started Roblox scripting lol but i might come back. I hate when you learn smth new u eventually quit. Bro dont be like me just keep going
This is THE BEST video about string methods on internet..... THE BEST>>>>>> Excellent..It made me understand everything about string methods...... Thankk you Sir...
age = float(input('ENTER YOUR AGE: ')) if age >= 18: b = input('ENTER YOUR USERNAME: ') name= len(b) if name > 12: print('YOUR USERNAME IS MORE THAN 12 LETTERS') elif b.count(' ') > 0 : print('YOUR USERNAME CONTAINS A SPACE') elif b.isdigit : print('YOUR USERNAME CONTAINS A DIGIT') else: print(f"YOUR USERNAME IS SET TO '{b}' ") else: print('YOU MUST BE 18+ TO SIGN UP')
I love when you implement Exercises in your Videos! Im new to programming and love solving these on my own ;P like for example i checked for numbers using isdigit insead of isalpha but it still worked. Keep up the good work
My Own Code! Still getting there as a beginner :) print("---Welcome to SliceN'Dice---") # Menu: Cheese Pizza, Pepperoni Pizza, Hawaiian Pizza, BBQ Pizza pizza = input("What type pizza would you like to purchase? (CP, PP, HP, BBQ): ") pizza_size = input("How big would you like your pizza to be? (S, M, L): ") if pizza == "CP" and pizza_size == "S": print("Here is your Small Cheese Pizza!") elif pizza == "CP" and pizza_size == "M": print("Here is your Medium Cheese Pizza!") elif pizza == "CP" and pizza_size == "L": print("Here is your Large Cheese Pizza!") elif pizza == "PP" and pizza_size == "S": print("Here is your Small Peperoni Pizza!") elif pizza == "PP" and pizza_size == "M": print("Here is your Medium Peperoni Pizza!") elif pizza == "PP" and pizza_size == "L": print("Here is your Large Peperoni Pizza!") elif pizza == "HP" and pizza_size == "S": print("Here is your Small Hawaiian Pizza!") elif pizza == "HP" and pizza_size == "M": print("Here is your Medium Hawaiian Pizza!") elif pizza == "HP" and pizza_size == "L": print("Here is your Large Hawaiian Pizza!") elif pizza == "BBQ" and pizza_size == "S": print("Here is your Small Barbeque Pizza!") elif pizza == "BBQ" and pizza_size == "M": print("Here is your Medium Barbeque Pizza!") elif pizza == "BBQ" and pizza_size == "L": print("Here is your Large Barbeque Pizza!") else: print(f"Error {pizza_size} {pizza} is not on the menu.") print("Order something on the menu.")
I love how you include exercises in your videos .But i actually used this code in the exercise: print('Username must not contain more than 12 letters') print('Must not contain spaces') print("And must not contain any digit") print('') user_n = input("Enter a username--") len(user_n) if len(user_n) > 12: print("Invalid username as it has too many chracters.") elif user_n.count(" ") != 0:#can/should also use user_n.find(" ") print(f"Invalid username as it contains {user_n.count(" ")} space/s.") elif user_n.isalpha() != True: print(f"Invalid username as it has a digit/s.") else: print("Valid Username !You can sign up...") This also works but one in the video is better
I think the exercise is easier this way: users_input=input ("enter input ") if len(users_input) < 12 and users_input.isalpha(): print("input valid") else: print("input not valid")
x = input("Nickname: ") while len(x) > 12 or len(x) == 0 or x.isalpha() == False: print("cant be more then 12 characters and cant contain spaces and cant contain digits") x = input("Nickname: ") print("Hi!", x.capitalize())
Hello Everyone! My take on it is: username=input(print("Enter Username:")) if len(username)>12 or username.find(" ")>=0 or not username.isalpha(): print("Wrong username! It CANNOT: * be more than 12 characters * contain spaces * contain numbers ") else: print(f"Welcome {username}!")
text = input("Enter your text: ") find = input("Enter the word to find: ") print(f"The word you looking for is at index number {text.find(find)}") How about that?
My solution to the exercise: isValid = False while not isValid: username = input("Enter your username: ") if len(username) > 12: print("Username must be less than 12 characters") continue elif not username.find(" ") == -1: print("Username must not contain any spaces.") continue elif not username.isalpha(): print("Username must be alphanumeric") continue else: print(f"Welcome {username}!") isValid = True
Will you make a tutorial series on Kotlin or teach Android development without Android studio please big bro?? I am not able to use Android studio in my low end pc and would love to learn Kotlin from you :)
name = input("what is your name: ") name = name.title() sub1 = len(name) if sub1 >=10: print("name is grater then 10") else: print("hello," + name) age = int(input("how old are you: ")) if age >=100: print("how are you even alive") elif age
username = input("What is your username: ") if len(username) > 12: print("The username shall not contain more then 12 characters.") if username.isdigit(): print("The username shall not contain digits.") if username.count("") > 1: print("The username shall not contain spaces.")
a way to embed expressions inside string literals in Python, using curly braces {}. They provide an easy and readable way to format strings dynamically. sentence = f"My name is {name} and I am {age} years old." otherwise it would have been name =("My name is",name)
I’m the last you can do: def check_username(username); If len(username) > 12: print(“Your username can’t be more than 12 characters “) elif not username.find(“ “) == -1: print(“Your username can’t contain spaces!”) for i in username: If type(i) == int: print(“Your username can’t contain numbers”)
I read a few codes that the commentators and realized that my code is shit name = input("Enter your username:" ) if len(name) > 12: print (f"Your username is too long") elif name.isdigit(): print (f"{name} is not valid symbols") elif not name.isalpha(): print (f"{name} is not valid symbols") else: print(f"Hello {name}!")
def main(): name = input("Type a Name #: ") z= filter(name) print(z) def filter(x): if len(x) > 12: return("Name can't be more than 12 characters") elif not x.find(" ")==-1: return("Name can't have any spaces") elif not x.isalpha(): return("Name can't contain numbers") else: return (f"Your Name is {x}") main()
user = input("Hello welcome create your user name: ") length = len(user) if user.strip().count(" "): print("Your user name cannot contain any spaces") elif length > 12: excess_l = length - 12 print("Im sorry but your user name cant contain more than 12 characters") print(f"Your user name is {excess_l} characters too long") elif user.isdigit(): print("Your username cannot contain any digit") else: print(f"Welcome {user} to website ")
name=input("enter the name :") if len(name) > 12 : print("no more than 12 character") elif " " in name: print(" no spaces ") elif not name.isalpha(): print(" no digits in name ") else: print(f" hello {name}")
nome = input("Insira seu nome de usuario (maximo 12, sem espaco e numeros): ") if len(nome) < 12 and nome.count(" ") == 0 and nome.isalpha() == True: print(f"Bem vindo {nome} owo uwu") else: print("Nome de usuario invalido ")
username = input("what is your username: ") num1 = len(username) if num1 >12: print("this username can only be 12 letters long ") elif not username.find(' ') == -1: print("username invalid due to space lease fix it") elif not username.isalpha (): print("username can not cointain digits") else: print(f"Hello, {username}
I think your code is wrong. What if the username contains a special symbol like "$" - it returns "can't contain digits" but this is not in the conditions
I did it like this and it worked w/o cheating username = str(input('Type your user name here :')) if len(username) > 12: print('your username cant be more than 12 characters!') elif not username.find(' ') == -1: print('your username cant contain any spaces!') elif username.isdigit: print('your username cant contain any numbers!') else: print(f'Hello {username}')
Hey! Isalpha() is checking much more than digits and instructions were digits. We would need to find() or count() every digit [1, 2, 3, 4…] something like that I think 😅
print("Your username should be less than 12 / should not contain spaces! / should not contain digits.") username = input('Input ur username: ') if len(username) < 12 and username.isalpha(): print('welcome bro') else: print("Your username should be less than 12 / should not contain spaces! / should not contain digits.")
that was great but I'm a bit confused why do we have to type (elif not usename.isalpha) and not just (elif usename.isalpha) can some one explain it to me please🤷🏾♂🤷🏾♂
.isalpha() checks if the string contains only alphabetical characters. if it does, it returns True, if it contains non-alphabetical characters such as numbers, it returns False. by using the "not" operator he reverses this. if the username contains numbers, it will now return True. not false = true not true = false if not username.isalpha() is true then that means the username contains numbers. without the "not" you would checking if the username *DOESN'T* contain numbers.
# -------------------------------
# STRING METHODS
# -------------------------------
# name = input("Enter your name: ")
# phone_number = input("Enter your phone #: ")
# length = len(name)
# index = name.find(" ")
# name = name.capitalize()
# name = name.upper()
# name = name.lower()
# result = name.isdigit()
# result = name.isalpha()
# result = phone_number.count(" ")
# phone_number = phone_number.replace("-", "")
# -------------------------------
# EXERCISE
# -------------------------------
username = input("Enter a username: ")
if len(username) > 12:
print("Your name can't be more than 12 characters")
elif not username.find(" ") == -1:
print("Your username can't contain spaces")
elif not username.isalpha():
print("Your username can't contain digits")
else:
print(f"Welcome {username}!")
info1 = print("your username has to be between 3 and 12 characters long!")
info2 = print("your username cant contain spaces and digits!")
username = input("Please enter your username: ")
if username.isdigit() or not username.isalpha():
print(f"{username} is not a valid username!")
elif len(username) = 13:
print(f"{username} is not a valid username!")
else:
print(f"Welcome {username}!!!")
this is how I did it, thx for the tutorials man
I used .isalpha to check for spaces:)
Every programming language is easy when explained by bro😎
did you quit sir?
@@Lit35 Dude do you need help?
@@enespinar9711 i quit and started Roblox scripting lol but i might come back. I hate when you learn smth new u eventually quit. Bro dont be like me just keep going
Very true
_Brooo.._ 😎
This is THE BEST video about string methods on internet..... THE BEST>>>>>> Excellent..It made me understand everything about string methods...... Thankk you Sir...
I'm new to coding and i will say, this is the best coding tutorial channel on TH-cam!
trueee
index = name.rfind("e")
age = float(input('ENTER YOUR AGE: '))
if age >= 18:
b = input('ENTER YOUR USERNAME: ')
name= len(b)
if name > 12:
print('YOUR USERNAME IS MORE THAN 12 LETTERS')
elif b.count(' ') > 0 :
print('YOUR USERNAME CONTAINS A SPACE')
elif b.isdigit :
print('YOUR USERNAME CONTAINS A DIGIT')
else:
print(f"YOUR USERNAME IS SET TO '{b}' ")
else:
print('YOU MUST BE 18+ TO SIGN UP')
You're the first person where I was able to solve the exercises at the end, I feel really proud of myself, thanks
watching your videos as part of my revision :)
nice exercise
extremely well explained.,.,thanks for your effort
Nice bro code
I love when you implement Exercises in your Videos! Im new to programming and love solving these on my own ;P like for example i checked for numbers using isdigit insead of isalpha but it still worked. Keep up the good work
i love this :D
U R AWESOME
bro code is the best teacher
with my upcoming exam this vid is a real helper
NICELY DONE BRO...❤
Respect to you man
You're great man, i'm enjoying a lot this course
Thanks a lot brother code
thanks Bro
thanks bro
i love bro
My Own Code! Still getting there as a beginner :)
print("---Welcome to SliceN'Dice---")
# Menu: Cheese Pizza, Pepperoni Pizza, Hawaiian Pizza, BBQ Pizza
pizza = input("What type pizza would you like to purchase? (CP, PP, HP, BBQ): ")
pizza_size = input("How big would you like your pizza to be? (S, M, L): ")
if pizza == "CP" and pizza_size == "S":
print("Here is your Small Cheese Pizza!")
elif pizza == "CP" and pizza_size == "M":
print("Here is your Medium Cheese Pizza!")
elif pizza == "CP" and pizza_size == "L":
print("Here is your Large Cheese Pizza!")
elif pizza == "PP" and pizza_size == "S":
print("Here is your Small Peperoni Pizza!")
elif pizza == "PP" and pizza_size == "M":
print("Here is your Medium Peperoni Pizza!")
elif pizza == "PP" and pizza_size == "L":
print("Here is your Large Peperoni Pizza!")
elif pizza == "HP" and pizza_size == "S":
print("Here is your Small Hawaiian Pizza!")
elif pizza == "HP" and pizza_size == "M":
print("Here is your Medium Hawaiian Pizza!")
elif pizza == "HP" and pizza_size == "L":
print("Here is your Large Hawaiian Pizza!")
elif pizza == "BBQ" and pizza_size == "S":
print("Here is your Small Barbeque Pizza!")
elif pizza == "BBQ" and pizza_size == "M":
print("Here is your Medium Barbeque Pizza!")
elif pizza == "BBQ" and pizza_size == "L":
print("Here is your Large Barbeque Pizza!")
else:
print(f"Error {pizza_size} {pizza} is not on the menu.")
print("Order something on the menu.")
Thanks 👍
So helpful, thank you!
thank you for explaining this so well!
I love how you include exercises in your videos .But i actually used this code in the exercise:
print('Username must not contain more than 12 letters')
print('Must not contain spaces')
print("And must not contain any digit")
print('')
user_n = input("Enter a username--")
len(user_n)
if len(user_n) > 12:
print("Invalid username as it has too many chracters.")
elif user_n.count(" ") != 0:#can/should also use user_n.find(" ")
print(f"Invalid username as it contains {user_n.count(" ")} space/s.")
elif user_n.isalpha() != True:
print(f"Invalid username as it has a digit/s.")
else:
print("Valid Username !You can sign up...")
This also works but one in the video is better
Thank you my bro, i have exam tmrw and this guide is goated on string functions ill check on your channel regularly to bro-ify python 💪
Holy shit, this taught me better than my programming teacher
3rd commmmment
this guys goated
What if I'm typing in spaces AND number, it only show "Your username cannot contains spaces" but not both
OMG I`M THE 100TH LIKE
I think the exercise is easier this way:
users_input=input ("enter input ")
if len(users_input) < 12 and users_input.isalpha():
print("input valid")
else:
print("input not valid")
x = input("Nickname: ")
while len(x) > 12 or len(x) == 0 or x.isalpha() == False:
print("cant be more then 12 characters and cant contain spaces and cant contain digits")
x = input("Nickname: ")
print("Hi!", x.capitalize())
Thanks
nice ved :)
Why do we use elif not here? Can someone explain in detail to help me understand better.
Thanks in advance
user_name = str(input("Please enter your name: "))
def check():
if len(user_name)
Your vids are incredibly helpful. How do you find or think of these practice programs?
Hello Everyone! My take on it is:
username=input(print("Enter Username:"))
if len(username)>12 or username.find(" ")>=0 or not username.isalpha():
print("Wrong username! It CANNOT:
* be more than 12 characters
* contain spaces
* contain numbers ")
else:
print(f"Welcome {username}!")
Bro, change username=input(print("Enter Username:")) to username=input("Enter Username:"), exlcude the "print" and try again.
also in place of isalpha cant we use isdigit() ??
text = input("Enter your text: ")
find = input("Enter the word to find: ")
print(f"The word you looking for is at index number {text.find(find)}")
How about that?
My solution to the exercise:
isValid = False
while not isValid:
username = input("Enter your username: ")
if len(username) > 12:
print("Username must be less than 12 characters")
continue
elif not username.find(" ") == -1:
print("Username must not contain any spaces.")
continue
elif not username.isalpha():
print("Username must be alphanumeric")
continue
else:
print(f"Welcome {username}!")
isValid = True
09:17: Why this code needs to have a 'f' string behind "Welcome {username}")? While the others dont?
f string is for inserting variable in a string inside of {}
@@AbhayRajKarun f string is top
but why it become -1 for cant contain any space
2nd comment
BRO CODE . JS, TS , Nodejs videos please
Will you make a tutorial series on Kotlin or teach Android development without Android studio please big bro?? I am not able to use Android studio in my low end pc and would love to learn Kotlin from you :)
Bro or Sir please upload REACTJS tutorial
Thoroughly convinced he founded python even though I know the guy who did. Bro code just explains things too well for him to not be Guido van Rossum
I did mine but i only used AND operators
name = input("what is your name: ")
name = name.title()
sub1 = len(name)
if sub1 >=10:
print("name is grater then 10")
else:
print("hello," + name)
age = int(input("how old are you: "))
if age >=100:
print("how are you even alive")
elif age
chad
what playlist this video in?
Why is the order matter?
username = input("What is your username: ")
if len(username) > 12:
print("The username shall not contain more then 12 characters.")
if username.isdigit():
print("The username shall not contain digits.")
if username.count("") > 1:
print("The username shall not contain spaces.")
Hi
can you explain how to write a PID code for Spike prime Robot?
thank you
Can someone explain why did he used == -1 in 10:54
if you watched the whole video through he explained that if theres no such char found it returns -1
who? aing oey who ami😂
can someone explain whats an f string
a way to embed expressions inside string literals in Python, using curly braces {}. They provide an easy and readable way to format strings dynamically. sentence = f"My name is {name} and I am {age} years old." otherwise it would have been name =("My name is",name)
I’m the last you can do:
def check_username(username);
If len(username) > 12:
print(“Your username can’t be more than 12 characters “)
elif not username.find(“ “) == -1:
print(“Your username can’t contain spaces!”)
for i in username:
If type(i) == int:
print(“Your username can’t contain numbers”)
why it contain the spaces so it become -1??
why didn t bro just replace input with bro code
readability
name = input("type name ")
if len(name) > 12:
print("type less bykvi blyaat")
elif name.find("suka") != -1:
print("ne pishi suka, suka")
elif not name.isalpha():
print("dont use digits suka")
else:
print(f"hello {name} suka ")
def checknum(text):
for i in text:
if i.isnumeric():
return False
else:
return True
username = input('enter username: ')
if len(username)
I read a few codes that the commentators and realized that my code is shit
name = input("Enter your username:" )
if len(name) > 12:
print (f"Your username is too long")
elif name.isdigit():
print (f"{name} is not valid symbols")
elif not name.isalpha():
print (f"{name} is not valid symbols")
else:
print(f"Hello {name}!")
def main():
name = input("Type a Name #: ")
z= filter(name)
print(z)
def filter(x):
if len(x) > 12:
return("Name can't be more than 12 characters")
elif not x.find(" ")==-1:
return("Name can't have any spaces")
elif not x.isalpha():
return("Name can't contain numbers")
else:
return (f"Your Name is {x}")
main()
u still programming?
.isdigit looks in a str for int and returns a bool 🤔🤨😵💫
user = input("Hello welcome create your user name: ")
length = len(user)
if user.strip().count(" "):
print("Your user name cannot contain any spaces")
elif length > 12:
excess_l = length - 12
print("Im sorry but your user name cant contain more than 12 characters")
print(f"Your user name is {excess_l} characters too long")
elif user.isdigit():
print("Your username cannot contain any digit")
else:
print(f"Welcome {user} to website ")
So now i know how these stupid websites program me to enter a password with letters and numbers
well actually, you might wanna look for the html tutorial
name=input("enter the name :")
if len(name) > 12 :
print("no more than 12 character")
elif " " in name:
print(" no spaces ")
elif not name.isalpha():
print(" no digits in name ")
else:
print(f" hello {name}")
nome = input("Insira seu nome de usuario (maximo 12, sem espaco e numeros): ")
if len(nome) < 12 and nome.count(" ") == 0 and nome.isalpha() == True:
print(f"Bem vindo {nome} owo uwu")
else:
print("Nome de usuario invalido ")
username = input("what is your username: ")
num1 = len(username)
if num1 >12:
print("this username can only be 12 letters long ")
elif not username.find(' ') == -1:
print("username invalid due to space lease fix it")
elif not username.isalpha ():
print("username can not cointain digits")
else:
print(f"Hello, {username}
I think your code is wrong. What if the username contains a special symbol like "$" - it returns "can't contain digits" but this is not in the conditions
Bro.isGigaChad()
#true
I did it like this and it worked w/o cheating
username = str(input('Type your user name here :'))
if len(username) > 12:
print('your username cant be more than 12 characters!')
elif not username.find(' ') == -1:
print('your username cant contain any spaces!')
elif username.isdigit:
print('your username cant contain any numbers!')
else:
print(f'Hello {username}')
Hey! Isalpha() is checking much more than digits and instructions were digits. We would need to find() or count() every digit [1, 2, 3, 4…] something like that I think 😅
print("Your username should be less than 12 / should not contain spaces! / should not contain digits.")
username = input('Input ur username: ')
if len(username) < 12 and username.isalpha():
print('welcome bro')
else:
print("Your username should be less than 12 / should not contain spaces! / should not contain digits.")
Hey, in 10:20 why I cannot use :
elif username.find(" ") == 1:
that was great but I'm a bit confused why do we have to type
(elif not usename.isalpha) and not just (elif usename.isalpha) can some one explain it to me please🤷🏾♂🤷🏾♂
.isalpha() checks if the string contains only alphabetical characters. if it does, it returns True, if it contains non-alphabetical characters such as numbers, it returns False. by using the "not" operator he reverses this. if the username contains numbers, it will now return True.
not false = true
not true = false
if not username.isalpha() is true then that means the username contains numbers. without the "not" you would checking if the username *DOESN'T* contain numbers.
username = input("Enter a username: ")
username.find(" ")
if len(username) > 12:
print("Your username cannot be more than 12 characters")
elif not username.find(" ") == -1:
print("Your username cannot contain spaces")
elif not username.isdigit():
print("Your username cannot contain digits")
else:
print(f"Welcome {username}!")
why cant we simply use not name.find(" ")
@@RahulSingh-xd4qj .find doesnt return bool