Re: I have an idea for an addon.

All right. Two things.
First, you should probably put a comma in the second to last line.  The fact that adjacent string literals merge is an obscure piece of python that no one uses, and is saving you from a syntax error in this case, but something like:
print 1 2
Needs to be:
print 1, 2
No one uses this feature, and none of the tutorials cover it.  It's just something that exists from a  very very very long time ago (Python's programming started in 1989).  This is obscure enough that I almost said you were getting a syntax error: "this doesn't work" is barely better than saying nothing in programming land, and this is about as obscure as saying you use an analog computer on a daily basis.  Python programmers do not intentionally use this, and as far as I know they haven't in 10 years or more.  Consequently, I got halfway through psoting before blinking and going "O, wait, it's nerd tri via"
At this point, I'd suggest describing what you expected and what you got with some verbosity, because you do not yet know all of the terminology to describe the problem you are having briefly and, as seen here, you can sometimes hit some weird corner cases as a new programmer.
Second, the reason the last line doesn't print is because you're not asking it to.  Text between quotes is called a string literal, one of a few different types of literal values.  You can think of a value as a thing like a number or a string: a small bit of useful data of some sort.  Print is a statement.  When you feed print an _expression_, it displays the result.
What you're doing in the last line of your program is assignment.  The value "it was a dark and stormy night" is now stored in the mystring variable.  The fact that the text (properly called a string) is text does not mean that it gets displayed, it's the fact that the print statement is being asked to display it that does so.  To employ a convenient fiction: What you're doing in the last line is asking python to create a box, label it mystring, and stick "it was a dark and stormy night" inside.
Here is an illuminating code fragment:

x = 1
print x
x=x + 2
print x
x= x * 3
print x

And this line at the end of your program will demonstrate it as well, though perhaps less effectively:

print mystring

Hope this was some help.



_______________________________________________
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Off-topic room : brad via Audiogames-reflector
    • ... AudioGames . net Forum — Off-topic room : frastlin via Audiogames-reflector
    • ... AudioGames . net Forum — Off-topic room : Muhammad Hajjar via Audiogames-reflector
    • ... AudioGames . net Forum — Off-topic room : brad via Audiogames-reflector
    • ... AudioGames . net Forum — Off-topic room : keyIsFull via Audiogames-reflector
    • ... AudioGames . net Forum — Off-topic room : brad via Audiogames-reflector
    • ... AudioGames . net Forum — Off-topic room : camlorn via Audiogames-reflector
    • ... AudioGames . net Forum — Off-topic room : brad via Audiogames-reflector
    • ... AudioGames . net Forum — Off-topic room : brad via Audiogames-reflector
    • ... AudioGames . net Forum — Off-topic room : camlorn via Audiogames-reflector
    • ... AudioGames . net Forum — Off-topic room : camlorn via Audiogames-reflector
    • ... AudioGames . net Forum — Off-topic room : camlorn via Audiogames-reflector
    • ... AudioGames . net Forum — Off-topic room : brad via Audiogames-reflector

Reply via email to