Learn Python Programming - 33 - List pattern square all list numbers (exercise)

preview_player
Показать описание
★☆★ ENROLL IN MY PYTHON COURSE: ★☆★

Enroll for coding exercises, projects, tutorials, and courses...
Clever Programmer
Snapchat ► Rafeh1 ...
Рекомендации по теме
Комментарии
Автор

almost 2k subscribers already, wow.
that's prove how good your tutorials are.
Keep it coming.

muhammadnaim
Автор

now already 10k subs, great job Qazi!

lpproductionlp
Автор

is there any built in function to swap the values of two variables? please reply

bishantadhikari
Автор

def square_numbers(number):
return number **2

print(square_number(2))
etc.

thegreyliongaming
Автор

numbers = [1, 2, 3, 4, 5, 6, ]
>>> squared_numbers = []
>>> for number in numbers:
squared_numbers.append(number ** 2)
print(squared_numbers)

tattolarousse
Автор

50k subs? oh your channel is amazingly growing . :)

combatxhoop
Автор

hello, what is the version of python ? I think is is important

soldadopreciso
Автор

Trying some solutions before watching the video.

NUMBERS = [1, 2, 3, 4, 5, 6, 7, 8]

result_solution_v1 = [number**2 for number in NUMBERS]

result_solution_v2 = []

for number in NUMBERS:


print(result_solution_v1)
print(result_solution_v2)

dvorapat
Автор

What if i want to replace the new value back into the old list?
ex.
original (number = [1, 2, 3, 4, 5, 6, 7])
new (number = [1, 4, 9, 16, 25, 36, 49] )

stevegreen
Автор

MY SOLUTIONS:


numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9]
squared_list = [x**2 for x in numbers]

abdullahsiddiqui
Автор

My solution:
for num in range (1, 10):
print (num**2)

amyjones
Автор

def math_square():
numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9]
squared_numbers = []
for number in numbers:

print(squared_numbers)
#return squared_numbers


I want to improve some python skill. Thats why add the function. But where is my mistake?

cgd
Автор

My solution:

numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9]
squared_list = []

for number in numbers:
squared_list.append(pow(number, 2))

print(squared_list)

...

stellarestuary
Автор

title typo, it should be programming not progamming

mfi
Автор

wow..the views have dropped drastically...seems people don't understand the value of learning this

vimuthabeysinghe