#🔒 attwmpting to code rock papwr scissors
81 messages · Page 1 of 1 (latest)
@fresh badger
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
you might need to try a simpler project first, like fizzbuzz, rock paper scissors, etc
ok
attwmpting to code rock papwr scissors
how do i do this then
im pretty clueless
How much programming do you know so far?
Do you know print for example?
:white_check_mark: Your 3.14 eval job has completed with return code 0.
hi
Great!
Do you know about input() ? You’ll need that to get an input out from the player.
!e
x=random.randint(1, 10)
print(x)
:white_check_mark: Your 3.14 eval job has completed with return code 0.
10
ye
!e
x=random.randint(1, 10)
print(x)
:white_check_mark: Your 3.14 eval job has completed with return code 0.
7
ok it is random
That is good, though not strictly necessary. It depends - will the second player be the computer or real?
computer
It’ll be easier for you to start with the second player being real
ok
And then convert the second player to a computer later
wait 1min
^
:x: Your 3.14 eval job has completed with return code 1.
001 | File [35m"/home/main.py"[0m, line [35m1[0m
002 | x=input[1;31m([0mstr("please choose an option: ")
003 | [1;31m^[0m
004 | [1;35mSyntaxError[0m: [35m'(' was never closed[0m
Yes, other than the syntax error that is it
the bot does not like input?
It can’t request input from you, but also you are typing it out slightly wrong
oh
Here’s where you should read the error it’s telling you
ohh
I would tell you, but it’s best if I don’t. This is where real learning happens.
fixed
Great! Let’s see the fixed version.
^
I don’t see it fixed there
colon after quote mark?
^ the error is here
oh
What does the error say?
Yes
Though you don’t need the str() there actually
oh
Because you already defined a string in double quotes
oh
" hello world "
This is already a string
yes
i think
!e
y=8
if x>y:
print("x in larger than y")
elif x<=y:
print("x is smaller or equal to y")```
You can’t have elif on its own
fixed :3
Yes!
But what if x is equal to y?
Note - if you want a condition at the end, that’s where you use else.
:white_check_mark: Your 3.14 eval job has completed with return code 0.
x is smaller than y
oop
Well, this is all we need to talk about anyway.
With input(), if/elif/else and print(), you can do a two player rock/paper/scissors with both as humans
So try it out when you can!
Put all of those together to make that program
👋
After you finish that, add randomness so you can play against the computer :]
This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.