# Can I ask a python question?

**URL:** https://discourse.codecombat.com/t/can-i-ask-a-python-question/18767
**Category:** Uncategorized
**Created:** [July 1, 2019, 8:58pm UTC](https://discourse.codecombat.com/t/can-i-ask-a-python-question/18767 "2019-07-01T20:58:22Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![ducky](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ducky/32/9364_2.png) [@ducky](https://discourse.codecombat.com/u/ducky)
#### Post date: [July 1, 2019, 8:58pm UTC](https://discourse.codecombat.com/t/can-i-ask-a-python-question/18767/1 "2019-07-01T20:58:22Z")

</div>

Can I ask a question about python that will be answered? Real python questions, not coco. Else, could you recommend another coding site that I can ask a python question on?

---

<div class="post-metadata">

### Author: ![Deadpool198](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/deadpool198/32/16753_2.png) [@Deadpool198](https://discourse.codecombat.com/u/Deadpool198)
#### Post date: [July 2, 2019, 8:20am UTC](https://discourse.codecombat.com/t/can-i-ask-a-python-question/18767/2 "2019-07-02T08:20:02Z")

</div>

Yes, I think I could answer some questions, I do do actual Python. 🐍  
🦁 🦁 🦁

---

<div class="post-metadata">

### Author: ![ducky](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ducky/32/9364_2.png) [@ducky](https://discourse.codecombat.com/u/ducky)
#### Post date: [July 2, 2019, 8:18pm UTC](https://discourse.codecombat.com/t/can-i-ask-a-python-question/18767/3 "2019-07-02T20:18:04Z")

</div>

```python
def um(a):
    count=0
    w=input("If you're done, type (\'d\'). What are your numbers? (One at a time, please) : ")
    while True:
        if w==1:
            break
        else:
            h.append(w)
    for i in h:
        count+=i
    return count

def product():
    h=[]
    while True:
        w=input("If you're done, type (\"d\"). What are your numbers? (One at a time, please) : ")
        if w=="d":
            break
        h.append(w)
        
    count=1
    for i in h:
        count=count*i
    return count

def quotient():
    a=input("Divisor: ")
    b=input("Dividend: ")
    h=input("With remainder (r), or not (n)?: ")
    h=h.lower()
    if h=='r':
        x=int(a/b)
        y=a%b
        c=f"The number is {x}, and the remainder is {y}!"
        return c
    elif h=="n":
        s=a/b
        return s

def difference():
    a=input("Minuend: ")
    b=input("Subtrahend: ")
    c=a-b
    return c

def exponent():
    a=input("What number?: ")
    b=input("What exponent?: ")
    c=a**b
    return c

def calculator():
    '''
    Literally a calculator
    '''
    while True:
        w=input("Multiplication (m), Division (d), Subtraction (s), or Addition (a), Exponent (e), or Put away your calculator (p)?: ")
        w=w.lower()
        if w=="p":
            break
        if w== "e":
            exponent()
        if w=="s":
            print(difference())
        if w=="d": #division
            return print(quotient())
        if w=="a": #addition
            return print(um())
        if w=="m": #multiplication
            return print(product())
        print("Cha-Chok.")

calculator()

```

I’m trying to make a calculator (for fun) and It doesn’t work.

---

<div class="post-metadata">

### Author: ![xython](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/xython/32/7269_2.png) [@xython](https://discourse.codecombat.com/u/xython)
#### Post date: [July 2, 2019, 10:31pm UTC](https://discourse.codecombat.com/t/can-i-ask-a-python-question/18767/4 "2019-07-02T22:31:25Z")

</div>

Checked only the Multiplication:

```python
def product():
    # code
        h.append(w) # error: make all computed string values numbers
        h.append(float(w))

```

and the product will work. The other functions also have similar errors. Checked the code in [http://pythontutor.com](http://split.to/yM62TSj) / The input screen is bottom left /  
I support the idea to have two new sections: **JavaScript/CoffeScript/ Help** and **Python Help** where to post similar questions.  
At this site you can also get live help.

 ![help](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/2X/c/c08caf3bdb1d0bd12d2638daeaecf4c5743a52a2.jpeg)

---

<div class="post-metadata">

### Author: ![ducky](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ducky/32/9364_2.png) [@ducky](https://discourse.codecombat.com/u/ducky)
#### Post date: [July 3, 2019, 6:14pm UTC](https://discourse.codecombat.com/t/can-i-ask-a-python-question/18767/6 "2019-07-03T18:14:20Z")

</div>

THANK YOU SO MUCH!! 🍙🍙🍙🍙🍙🍙🍙🍙🍙😀😀😀😀😀😀😀

---

<div class="post-metadata">

### Author: ![ducky](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ducky/32/9364_2.png) [@ducky](https://discourse.codecombat.com/u/ducky)
#### Post date: [September 14, 2019, 6:32pm UTC](https://discourse.codecombat.com/t/can-i-ask-a-python-question/18767/7 "2019-09-14T18:32:01Z")

</div>

Hello, I am posting this here and on reddit, I need help with this code:

```python
def rps():
    a=str(input("What is your name?: "))
    b=str(input("And your name?"))
    c=str(input(f"{a}, do you want to choose rock(r), paper(p), or scissors(s)?: "))
    e="NO CHEATING! \n"
    print(e*100)
    d=str(input(f"{b}, do you want to choose rock(r), paper(p), or scissors(s)?: "))
    if a=="r"or a=="p"or a=="s" and b=="r"or b=="p"or b=="s":
        if a==b:
            print("It's a tie!")
        elif a=="r":
            if b=="p":
                print(f"{b} wins!")
            elif b=="s":
                print(f"{a} wins!")
        elif a=="p":
            if b=="r":
                print(f"{a} wins!")
            elif b=="s":
                print(f"{b} wins!")
        elif a=="s":
            if b=="p":
                print(f"{a} wins!")
            elif b=="r":
                print(f"{b} wins!")
        g=str(input("Play again? Yes(y) or no(n)?: ")
        if g=="y":#error
            rps()#error
        elif g=="n":
            print("Ok then. Bye!" )
        else:
            print("I'm assuming that's a no. Bye!")
rps()

```

help!

---

<div class="post-metadata">

### Author: ![xython](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/xython/32/7269_2.png) [@xython](https://discourse.codecombat.com/u/xython)
#### Post date: [September 14, 2019, 7:37pm UTC](https://discourse.codecombat.com/t/can-i-ask-a-python-question/18767/8 "2019-09-14T19:37:46Z")

</div>

I changed some name variables and corrected the if statement:

```python
def rps():
    aGamer=str(input("What is your name?: "))
    bGamer=str(input("And your name?"))
    aGamerChoice=str(input(f"{aGamer}, do you want to choose rock(r), paper(p), or scissors(s)?: "))
    e="NO CHEATING! \n"
    print(e*100)
    bGamerChoice=str(input(f"{bGamer}, do you want to choose rock(r), paper(p), or scissors(s)?: "))
    if (aGamerChoice=="r"or aGamerChoice=="p"or aGamerChoice=="s") and (bGamerChoice=="r"or bGamerChoice=="p"or bGamerChoice=="s"):
        if aGamerChoice==bGamerChoice:
            print("It's a tie!")
# so on ...

rps()

```

Use meaningful names. You can continue alone and ask later if difficulties…

---

<div class="post-metadata">

### Author: ![ducky](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ducky/32/9364_2.png) [@ducky](https://discourse.codecombat.com/u/ducky)
#### Post date: [September 14, 2019, 11:42pm UTC](https://discourse.codecombat.com/t/can-i-ask-a-python-question/18767/9 "2019-09-14T23:42:26Z")

</div>

I figured out that I hadn’t put a parentheses on the end of a line. Oh, computers. Thanks for helping me, though.
