The 1st part of the vid sorta confused me. I don't quite understand the print '%s %s' % (first,last). . .When did we learn that? I know vid #17 showed using the %s in a string & using % then the variable name, but I don't understand that part. Why are the %s in single quotes? And why % (first,last)??
@Colstonewall Look up a vid on python print formatting or string formatting. Basically the '%s's means that there is going to be something that the programmer will define at that part in the string. The percent sign is telling the print function that it is going to be formatting, and the part in the parenthesis defines what the '%s's are. The first %s is for the value stored in 'first' and the second %s is the value stored in 'last'. Hope that helped, though I'm sure you know by now. MONTH LATE
@skaneification 3.2 is not good right now so not many peope teach it the reason is that being so new it is not suppored with all of it's libs so use 2.6 or 2.7 for now and things will always work for you in these tuts
I did "return" instead of "print" since this is a function. I wonder if it's just like java, where whenever your just want to print you don't have to return...
@tonyram19 Basically to put it short, when u use more complex and longer scripts, this will be easier, if you stick with python, you will find out yourself :)
I didnt even remember I asked this :P I figured that you dont have too put the ( ) signs in the printstatement, cause without them you dont need the %s. thats probably it :)
How do you do this on Python 3+? mine says 'unsupported operand type(s) for %: 'non type' and 'tuple'' Please help.
eamon790 3 days ago in playlist Python Tutorials
hey, can someone say me why this is happening . This is the source code of the program:
def name(fisrt='john', last='smith'): print '%s %s' % (first,last)
name() And this the output: Traceback (most recent call last): File "C:/Users/Vision/Desktop/1.py", line 2, in name print '%s %s' % (first,last)
NameError: global name 'first' is not defined
I'm using python 2.7.2
harito94 1 month ago in playlist Python Programming Tutorials
Comment removed
Geebsee 1 month ago in playlist Python Programming Tutorials
@harito94
typo: def name(fisrt='john') should be def name(first='john')
Geebsee 1 month ago in playlist Python Programming Tutorials
@harito94 you spelled "first" wrong..
take a look at your first line...
you have def name(fisrt=......)
it should be "first"
PeyamCham 3 days ago
@PeyamCham thank you a lot, I really haven't seen my spelling failure
harito94 3 days ago
for those who use 3.2 u can do this tutorial like this :
def name (first,last): print ('%s %s' % (first,last))
follow rest of video by using it : ) give me green so rest can c it ;p
Exerlol 4 months ago 12
python is simple language
and i hope it's will be simple exam too
eiiwlee 5 months ago
The 1st part of the vid sorta confused me. I don't quite understand the print '%s %s' % (first,last). . .When did we learn that? I know vid #17 showed using the %s in a string & using % then the variable name, but I don't understand that part. Why are the %s in single quotes? And why % (first,last)??
Colstonewall 5 months ago in playlist More videos from thenewboston
@Colstonewall Look up a vid on python print formatting or string formatting. Basically the '%s's means that there is going to be something that the programmer will define at that part in the string. The percent sign is telling the print function that it is going to be formatting, and the part in the parenthesis defines what the '%s's are. The first %s is for the value stored in 'first' and the second %s is the value stored in 'last'. Hope that helped, though I'm sure you know by now. MONTH LATE
Joshplaysinstruments 3 months ago
@Colstonewall %s %s mean first and last strings of "bucky","roberts" so the first and last strings are bucky roberts
zoomer328 3 months ago
Who are the two people who keep on disliking this video? Its annoying me
paulceltics 6 months ago
Reached 28! Almost to 30 :D
XxstringtheoryxX 6 months ago
This has been flagged as spam show
If you're using python 3.0+, do it this way:
def name(first='tom',last='smith'): print ('%s %s' % (first,last))
name('bucky','roberts') will change the default words 'tom' 'smith'
ItsaUFOduh 7 months ago
Comment removed
ItsaUFOduh 7 months ago
Comment removed
ItsaUFOduh 7 months ago
for some reason the create a function is giving my a syntax error in 3.2 anyone know how to fix?
skaneification 9 months ago
@skaneification download 2.7.1 and it'll fix it.
darknate2004 9 months ago
@skaneification 3.2 is not good right now so not many peope teach it the reason is that being so new it is not suppored with all of it's libs so use 2.6 or 2.7 for now and things will always work for you in these tuts
TheKurtPrice 6 months ago
good job theres no voice crack at the end!
00pivot3lite00 11 months ago
I did "return" instead of "print" since this is a function. I wonder if it's just like java, where whenever your just want to print you don't have to return...
SSweetAngel 11 months ago
So I guess there's no operator overloading in python?
Dianeva89 11 months ago
fantastic job on these tutes (y)
randomking333 1 year ago
what if ur name is Tom Smith :P
randomking333 1 year ago
@randomking333 then you don't have as much work ;)
Roundfull 1 year ago
1 person doesn't know python
srry198 1 year ago
Each time I go on to the next tutorial, I see less and less viewers. Thumbs up for sticking with it and not giving up! WE ARE THE SURVIVORS!
12345678910secret 1 year ago 6
@12345678910secret it's not about that , some people look for something in python , they just watch the video they need
TheADMIRAL911 1 year ago
@TheADMIRAL911 How would that explain the fact that there are less viewers on each video?
Dianeva89 11 months ago
Isn't it easier to just:
def name(first,last): print first, last
???
Without the "%s %s".
tonyram19 1 year ago 2
@tonyram19 in this case yes, but in other cases nope :)
paraphernailia 1 year ago
@paraphernailia How come?
tonyram19 1 year ago
@tonyram19 Basically to put it short, when u use more complex and longer scripts, this will be easier, if you stick with python, you will find out yourself :)
paraphernailia 1 year ago
you didn't explained more about the %s here D:! I know a bit about the %s from tutorial 17 but not fully :(
RevaqOfTheLight 1 year ago
I love how as tutorials go more complex, they have less viewers xP
xXxDiukexXx 1 year ago 3
Hey Bucky do you have any tutorials out there that help with a programming a program assignment from start to finish?
TopOfDaWall 1 year ago
@TopOfDaWall I can help cha :D
xXxDiukexXx 1 year ago
for python 3
def name(first,last): print ('%s %s' % (first, last))
Grigoris179 1 year ago
This has been flagged as spam show
what does '%s %s' % mean???
Grkgermn333 1 year ago
This has been flagged as spam show
what does '%s %s' % mean???
Grkgermn333 1 year ago
very interesting. i can't wait to populate data bases!
adamsiddhi 1 year ago
for those of you using python 3.0, it uses different syntax in some cases. look up a python 3.0 tutorial.
lionheartt77 1 year ago
Thank you very much for this tutorial.
JOMOVID 1 year ago
this one also isnt working on python 3.0 =(
elljp1993 1 year ago
thanks man
TheLem93 1 year ago
Thank you very much.
wamdpst 2 years ago
The correct title is actually "default arguments" as an argument is the value, a parameter is the name.
fallrite 2 years ago 3
why use the %s ? it works just as good without them. just writing print first, last?
henkyxxx 2 years ago
if you use: print first + last, there wont be the space in the middle of the 2 words.
>>>name('bucky', 'roberts')
buckyroberts *instead ot bucky roberts*
jellene4eva 2 years ago
I didnt even remember I asked this :P I figured that you dont have too put the ( ) signs in the printstatement, cause without them you dont need the %s. thats probably it :)
henkyxxx 2 years ago
@jellene4eva u could just do "first + ' ' + last" but the way he did it is probably more efficient and easier to read for most python users
pivotofpower 2 years ago
Still Great :D
XRobiX 2 years ago
great job keep it up
Adj19888 2 years ago 9
Thank you alot ;)
Plubliii 2 years ago 3
Good tutorial
netsoj 2 years ago 6
your tuts are gr8, keep it up. 5/5*
nilabjo2008 2 years ago 70
First, and yet another great vid. Keep 'em up :)
YouGotTeaBagged 2 years ago 48