Skip to content
Sign UpLog In
This post is read-only. Explore Repls and connect with other creators on Community.View Community
The info in this post might be out of date, check out our docs instead. View docs
4

how to use the Python if and else Function

gatorade322
gatorade322

This repl shows how to use the if and else function. If you run it many times, you will see that there are two endings. Also try to figure out how it works.

3 years ago

Voters

Comments

TopNew
2

You know, you could just combine the tutorials together. The tutorials arent good either. You didnt explain how they work, you just showed code, like your asking for cycles

3 years ago
1
AidenTV1
AidenTV1

the 9th row(program)

1 year ago
1
AidenTV1
AidenTV1

why is this working
import random

rannum = random.randint(1, 100)

print("The random number is within 1 ~ 100")
while(true):
playernum1 == int(input("What number will you chose? 1 to 100.\n"))

if playernum1 == rannum :
print("congrets!")

elif playernum1 <= rannum :
print("a little higher!")

else:
print("a little more lower!")

1 year ago
1
gatorade322
gatorade322

Wow, I made this a long time ago. Now I see how bad the quality of my tutorial was! (: I'll try to make some better ones in the future.

2 years ago
1
AidenTV1
AidenTV1

@gatorade322
help

1 year ago
1
JacobSedgebeer
JacobSedgebeer

thanks this helped a lot! I couldn't figure out how to do the randomized randit

2 years ago
Load more