You tube limits how much code I could put in the Description
Follow my github for all the code
https://github.com/C0deDefense/Python...
#################Part 1
#If statements
#simply we have take input and ran it through a loop
#now we will utilize if statements to set a conditional test
#if a condition is met perform these actions
#if test
#What if we had a list of brands
#if the brand is GAP we want all letters in the name to be captilized
brandslist = ['Nike','Adidas','Gap']
for brand in brandslist:
if brand == 'Gap':
print(brand.upper())
else:
print(brand.title())
#The loop checks if the item matchs Gap if so it performs an action
################End Part 1
################Part 2
#Conditional test
We could set a conditional test
if the value matchs a certain character the boolean value will be set to true or false
brand = "Nike" #here we are saying set the brand variable to Nike
print(brand == 'Nike') #Here we are asking does the brand equal nike? see == and ?
#returns true if the brand is Nike and false otherwise
##################end Part 2
#################Part 3
#Case matters Tie fighter in python doesn't equal tie fighter due to the lower case
fighter = 'Tie fighter'
print(fighter == 'tie fighter')
#################end Part 3
#################Part 4
#you could run the variable through a lower() method
#we take the value Tie fighter and run it throught the lower method
#the lower method will lower case the Tie to tie fighter
#this will cause the two to become equal
fighter = 'Tie fighter'
print(fighter.lower() == 'tie fighter')
################### END Part 4
##################Part 5
#Here
#fighter = 'Tie fighter'
#print(fighter.lower() == 'tie fighter') we checked if the value stored in the fighter value is
#equal to the 'tie fighter' if so prints true
#now print the ships variable does it change
#no the value is not altered. The lower() doesn't change the original value
fighter = 'Tie fighter'
print(fighter.lower() == 'tie fighter')
print(fighter)
#################END Part 5
На этой странице сайта вы можете посмотреть видео онлайн Python Crash Course Section 5 If Statements длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Cybersecurity Striker 20 Июнь 2022, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 66 раз и оно понравилось like зрителям. Приятного просмотра!