Python Basics Code (Print,If,Else)

Hi this is some basic Python code to use in your projects:

print("Hello World")
example1 = input("hi-this-is-a-tutorial")
if example1 == "hope-you-like-it":
else:

I’ll be very interested to see what you can make with this! Pls comment a link to your amazing projects!

3 Likes

I’ll add an update/ extension soon.

I also know a tiny bit of html.

Not to be mean or rude or anything, but this is the extreme basics, it’s nothing new. I don’t even code in Python and I know this stuff.

If you want, try the Python 100 days course, it’ll help beginners with coding in Python.

1 Like

yes they learned all of this in basics, but i doubt many people came to trying

print("hello") if True else "meow"

And one-liner games

If True is ever false (which it isn’t) then it wouldn’t print anything btw

print("hello" if True else "meow")

then

print("hello") if True else print("meow")

Can you do a single liner if statement on a function call?

Yes, I did that in an experiment on one of my projects for some hacky formatting, and it actually does work ¯⁠\⁠_⁠(⁠ツ⁠)⁠_⁠/⁠¯

Also:

*in a function call

I think.

im going to test it

lets find out

this ^

I did it too.

No. In a function call would be the example I posted. On a function call would be the example @DefendyPug posted.

I misunderstood then. I’m not sure whether what @DefendyPug posted works or not.

1 Like

You learn something new everyday, and i just taught someone something!