home work problem = using for loop list print First char in Capital. this is by using list comprehension animals = ['lion','tiger','monkey','elephant','frog'] filtered_animal = [animal.title() for animal in animals] print(filtered_animal)
This concept can be used in data scrapping like extracting the data and saving in j.names[ ] My suggestion is to give examples of code can be used in what scenarios so that interest and concept will be strong for new learners.
animals =[ 'lion' ,'tiger', 'monkey', 'elephant', 'frog'] filtered_animals=[ animals.tittle() for animal in animals ] filtered_animals=['Lion', 'Tiger', 'Monkey', 'Elephant', 'Frog'] When we use tittle() method on string it will do each letter of first character will upper case remaining lower case and it will return string and it doesn't take parameters
#list comprehension(conv. from for loop), shortened list animals = ['lion', 'tiger', 'python'] filtered_animals=[animal.title() for animal in animals] print(filtered_animals) # Output: ['Lion', 'Tiger', 'Python']
home work problem = using for loop list print First char in Capital.
this is by using list comprehension
animals = ['lion','tiger','monkey','elephant','frog']
filtered_animal = [animal.title() for animal in animals]
print(filtered_animal)
You must be very good at planning things !! Your videos are extremely organized !! Watching like a Web series !!
Your teaching language owesom 😅 sometimes I forget that you are speaking in English 😅
😂
This concept can be used in data scrapping like extracting the data and saving in j.names[ ]
My suggestion is to give examples of code can be used in what scenarios so that interest and concept will be strong for new learners.
@@izainonline hello . Do you have a Channel..? Thanks for the tip.
Wow man you explain programming best out of other youtubers ngl
Thx and my answer is
filtered_animals= [x.title() for x in animals ]
please let me what's correct answer..
This is a hard topic, but well explained.
Homework question answer -:
animals = ['lion' , 'tiger' , 'monkey' , 'elephant' , 'frog']
filtered_animals=[animal.title() for animal in aminals]
print(filtered_animals)
Osm teaching nice explanation ❤❤❤
ani = ['lion', 'tiger', 'monkey','elephant']
ani_2 = [x.title() for x in ani ]
ani_2
Very helpful, thanks :)
animals =[ 'lion' ,'tiger', 'monkey', 'elephant', 'frog']
filtered_animals=[ animals.tittle() for animal in animals ]
filtered_animals=['Lion', 'Tiger', 'Monkey', 'Elephant', 'Frog']
When we use tittle() method on string it will do each letter of first character will upper case remaining lower case and it will return string and it doesn't take parameters
*animal.tittle()
[animal.title() for animal in animals]
I was gonna comment the same!
animal = ["lion","tiger","monkey","elephent","frog"]
Fanimal = [a.title() for a in animal]
print(Fanimal)
What is the animal.title function and why followed by the ()..
Thanks
it's a string method used to convert a first character of a string to an uppercase then the rest are converted to lowercase characters
Super
filtered_animals=[animal.title() for animal in animals]
list(print("animal.title()" for animal in animals))
filtered_animals = [value.title() for value in animals]
i'm not able to run list comprehension example .
me too
Sir can we have python DSA classes please
filtered_animals = [ "animal title() " for animal in animals]
#list comprehension(conv. from for loop), shortened list
animals = ['lion', 'tiger', 'python']
filtered_animals=[animal.title() for animal in animals]
print(filtered_animals) # Output: ['Lion', 'Tiger', 'Python']
animals = ["lion", "tiger", "elephant", "monkey", "frog"]
animals_2 =[animal.title() for animal in animals]
print(animals_2)
#Homework
filtered_animals = [animal.title() for animal in animals]
print(filtered_animals)
>>> animals = ["lion", "tiger", "monkey", "elephant", "frog"]
>>> filtered_animals = [animal.title() for animal in animals]
>>> filtered_animals
['Lion', 'Tiger', 'Monkey', 'Elephant', 'Frog']
>>>animals = ['lion', 'tiger', 'monkey', 'elephant', 'frog']
>>>Filtered _animals = [animal_title() for animal in animals]
>>>Filtered _animals
['lion', 'tiger', 'monkey', 'elephant', 'frog']
>>>
animal = [i.title() for i in animals]
animal
['Lion', 'Tiger', 'Monkey', 'Elephant', 'Frog']
animals= ['lion','tiger','monkey','elephant','frog']
filtered_animals=[animal.title() for animal in animals]
print(filtered_animals)
output: ['Lion', 'Tiger', 'Monkey', 'Elephant', 'Frog']
animals = ['lion', 'tiger', 'monkey', 'elephant', 'frog']
filtered_animals = [ ]
filtered_animals = [name.title( ) for name in animals]
print(filtered_animals)
animals = ['lion','tiger','monkey']
f_animals = [animal for animal in animals]
print(f_animals)
First
animals = ['lion', 'tiger', 'monkey', 'elephant', 'frog']
filtered_animals = [animal.title() for animal in animals]
Ans:
```
animals = ['lion', 'tiger','monkey','elephant','frog']
filtered_animals = [animal.title() for animal in animals ]
print(filtered_animals)
```
name for name in names if "J" in name... You could think of anything more complex🤣
animals = ['lion', 'tiger', 'monkey', 'elephant', 'frog']
filtered_animals = [animal.title() for animal in animals ]
print(filtered_animals)
filtered_animals = [animal.title() for animal in animals]
animals = ["lion", "tiger", "elephant", "monkey", "frog"]
animals_2 =[animal.title() for animal in animals]
print(animals_2)
filtered_animals = [animal.title() for animal in animals]
filtered_animals=[animal.title() for animal in animals ]
filtered_animals = [animal.title() for animal in animals]
filtered_animals = [animal.title() for animal in animals]
filtered_animals=[animal.title()for animal in animals]