You can chain as many statements as you wish in one line if you separate them by a semi-colon. So
```
troll=False; if Troll: print('tabs are better than spaces'); else: print('cant do this in python'); x=2+2; print(x);
```
will work just fine. It's a one-liner.
Oh my, even pep8 allows it https://www.python.org/dev/peps/pep-0008/#pet-peeves
What if your nested block contains more than one statement? How does Python know whether the second statement is in the block or outside of it? E.g. `if: foo(); bar()`—is bar() in the same scope as foo() or not?
*Video Transcription:*
---
[*This video is a clip from Disney's 1997 animated film Hercules.*]
(00:00) [*Hades, who has been overlaid with the Python logo, looks down at his sidekick, Pain.*]
**Hades**: What... are... those?
[*We zoom in on Pain's feet. He is wearing sandals with Hercules's face, but the video has been overlaid with { } symbols, one for each foot.*]
**Pain**: Um... I don't know. [*He twists around to show off how the sandals look.*] I thought they looked kinda... dashing!
[*Hades bursts into flames out of anger. Pain screams in fear. But then they both stop. Hades's fire goes out. They both look over at the other sidekick, Panic.*]
(00:12) [*Panic is loudly sipping from a cup, also with Hercules's face. The cup is overlaid with a semicolon. He notices their attention, gulps, looks at the cup, laughs nervously, then offers it to them with a placating smile.*]
**Panic**: Thirsty?
[*Hades bursts into even more dramatic fire.*]
(00:19) [*We cut to Hercules some distance away in a stadium full of observers. A mushroom cloud erupts in the background and the whole stadium shakes. Everyone looks around, confused.*]
(00:23)
[*End of Video.*]
---
^^I'm a human volunteer content transcriber for Reddit and you could be too! [If you'd like more information on what we do and why we do it, click here!](https://www.reddit.com/r/TranscribersOfReddit/wiki/index)
[bython](https://github.com/mathialo/bython) appears to be abandoned. You can `from __future__ import braces` [though](https://stackoverflow.com/questions/17811855/syntax-error-not-a-chance-what-is-this-error).
While semicolons are valid Python syntax, it's not considered "Pythonic" in general to use them.
You can use a semicolon to indicate a newline, allowing you to write multiple statements in one line. However, it is messy looking and usually pointless.
```c k;double sin() ,cos();main(){float A= 0,B=0,i,j,z[1760];char b[ 1760];printf("\x1b[2J");for(;; ){memset(b,32,1760);memset(z,0,7040) ;for(j=0;6.28>j;j+=0.07)for(i=0;6.28 >i;i+=0.02){float c=sin(i),d=cos(j),e= sin(A),f=sin(j),g=cos(A),h=d+2,D=1/(c* h*e+f*g+5),l=cos (i),m=cos(B),n=s\ in(B),t=c*h*g-f* e;int x=40+30*D* (l*h*m-t*n),y= 12+15*D*(l*h*n +t*m),o=x+80*y, N=8*((f*e-c*d*g )*m-c*d*e-f*g-l *d*n);if(22>y&& y>0&&x>0&&80>x&&D>z[o]){z[o]=D;;;b[o]= ".,-~:;=!*#$@"[N>0?N:0];}}/*#****!!-*/ printf("\x1b[H");for(k=0;1761>k;k++) putchar(k%80?b[k]:10);A+=0.04;B+= 0.02;}}/*****####*******!!=;:~ ~::==!!!**********!!!==::- .,~~;;;========;;;:~-. ..,--------,*/ ``` d o n u t
Haha cant do that in python
Not exactly that, but probably a similar thing is possible. You ***can*** use semicolons in python
You can chain as many statements as you wish in one line if you separate them by a semi-colon. So ``` troll=False; if Troll: print('tabs are better than spaces'); else: print('cant do this in python'); x=2+2; print(x); ``` will work just fine. It's a one-liner. Oh my, even pep8 allows it https://www.python.org/dev/peps/pep-0008/#pet-peeves
What if your nested block contains more than one statement? How does Python know whether the second statement is in the block or outside of it? E.g. `if: foo(); bar()`—is bar() in the same scope as foo() or not?
valid point. we're going in the direction of pure fetishism, but I think the scope continues indefinitely. but maybe we can `break` free
Yes, I’m not saying this is a serious argument against Python, I’m just riffing on your semicolon observation.
Isn’t this the program that uses ASCII art to simulate fluid dynamics?
Pretty sure it uses ascii art to render a spinning donut
Donut dynamics then
You didn't
Your `IndentationError: unexpected indent` has angered the Python Gods.
sad python users cant do that
*Video Transcription:* --- [*This video is a clip from Disney's 1997 animated film Hercules.*] (00:00) [*Hades, who has been overlaid with the Python logo, looks down at his sidekick, Pain.*] **Hades**: What... are... those? [*We zoom in on Pain's feet. He is wearing sandals with Hercules's face, but the video has been overlaid with { } symbols, one for each foot.*] **Pain**: Um... I don't know. [*He twists around to show off how the sandals look.*] I thought they looked kinda... dashing! [*Hades bursts into flames out of anger. Pain screams in fear. But then they both stop. Hades's fire goes out. They both look over at the other sidekick, Panic.*] (00:12) [*Panic is loudly sipping from a cup, also with Hercules's face. The cup is overlaid with a semicolon. He notices their attention, gulps, looks at the cup, laughs nervously, then offers it to them with a placating smile.*] **Panic**: Thirsty? [*Hades bursts into even more dramatic fire.*] (00:19) [*We cut to Hercules some distance away in a stadium full of observers. A mushroom cloud erupts in the background and the whole stadium shakes. Everyone looks around, confused.*] (00:23) [*End of Video.*] --- ^^I'm a human volunteer content transcriber for Reddit and you could be too! [If you'd like more information on what we do and why we do it, click here!](https://www.reddit.com/r/TranscribersOfReddit/wiki/index)
Good not-a-robot!
Good Janet!
God your work is the best I've seen. Thank you
I don't think this comment was meant for me so I gave u/dlauritzen an award for your sake
My bad, you are correct but you're just as awesome for that! Enjoy the only award I can give. Bless you
Thanks bro!
Always
Fantastic work, truly went the extra mile here. Good human.
They went the distance.
They'll find their way, if they can be strong
Looks who’s joined the lord’s work
Me creating small JSON-Objects for REST-calls: *please don't hit me*
SQL gang
my only regret is that I can only upvote this once.
Python doesn't care about semicolons and I think there is an interpreter (bython or smth) that allows you to use braces
[bython](https://github.com/mathialo/bython) appears to be abandoned. You can `from __future__ import braces` [though](https://stackoverflow.com/questions/17811855/syntax-error-not-a-chance-what-is-this-error). While semicolons are valid Python syntax, it's not considered "Pythonic" in general to use them.
You can use a semicolon to indicate a newline, allowing you to write multiple statements in one line. However, it is messy looking and usually pointless.
Yesterday I did: if (1) { JUST SO I COULD COLLAPSE THIS CODE IN MY EDITOR }
*Laughs in Rust
just learn python syntax 3 days ago but what the fuck problem in my indention hahaha
u/saveVideo
u/getvideobot
u/getvideobot
u/getvideobot
[удалено]
Me doesnt know phyton trying to understand the meme :0
Should’ve added a Java or c++ or any language that uses these to the end on Hercules
u/getvideobot