Introducing Functions | Python for Beginners [29 of 44]

preview_player
Показать описание


#microsoftdeveloper #pythonforbeginners #learntocode
Рекомендации по теме
Комментарии
Автор

Thank you so much!. I finally understood ‘functions’. I like the way you explained about the repetitive work and how functions help with that.

MySaimai
Автор

Experimenting - you can combine these two lines into this and it works:
first_name_initial = get_initial(input('Enter your first name: '))
Maybe sacrificing some readability - but it seems straightforward and you don't have to use an extra variable.

rob
Автор

You could make that code a little more efficient in the definition, by having the following :-


def get_initial(name):
return name[0:1]

kevinhollis
Автор

Muchas gracias!
I now understand functions.

cristobalvalladares
Автор

At 6:00, 'and I ask for one character' is a little confusing...Since will give nothing, rather than 1 character starting from position 3.

antonwang
Автор

We aren't lazy, we are comfortably efficient.

yackman
Автор

i just wish you explained the syntax of writing functions a little more and not briefly toward the end of the video.

marflage
Автор

With this idea of a function returning a value, aren't the earlier functions (in the video) ending with print() also returning a value? Since print() produces an output?
Trying to understand why the functions later in the video are referred to as returning values and the earlier ones are not.

VictorOlet
Автор

why is there
\
this is print statement ??

ritikadhiman
Автор

Why are there hardcore coders in the comment section trying to show off to us newbies

JPR
Автор

I am thinking another method could be:

initials = get_initial(first_name) + get_initial(last_name)

then you can extract the first or last initial as needed (initials[0:1])

Advantages or disadvantages?

JKarle
Автор

it's possible to extract the initials using name[0].
name[x] reterns the character in position x, first character having index 0.

abdelhadiaziz
Автор

Why slice the list with [0:1] instead of just using [0]?

adrianmuller
Автор

Anyone else getting the "name not defined" after being prompted to enter the first name?

adriansillsii
Автор

why is datetime written like this?
datetime.datetime.now()

tursh_city
welcome to shbcf.ru