I have no idea

Hi I’m new to python
I have a problem at the dice part
i can’t seem to solve it

""" makes dice guess"""
from random import randint
from time import sleep
def get_user_guess():
  guess = raw_input("Guess a number: ")
  return guess
def roll_dice(number_of_sides):
  first_roll = randint(1,number_of_sides)
  second_roll = randint(1, number_of_sides)
  max_val = number_of_sides * 2
  print "maximum is %d % max_val" % max_val
  guess = get_user_guess()
  if guess > max_val:
    print "number is above limit"
    print "rolling..."
    print "the 1st roll is : d%" % first_roll
    print "The 2nd roll is: %d" % second_roll
    total_roll = first_roll + second_roll
    print "result..."
  if guess == total_roll:
    print "you won!"
    print "you lost"

Hi, i’m kinda new to Python too. I’m doing the CS path course. Can you please edit your post for the entire code to be formatted? it’s pretty hard to read a Python code where everything is unindented.

if guess == total_roll:
    print "you won!
    else: guess != total_roll
      print "you lost"

At least on this part, i can tell you that else should go at the same indentation level that if, can’t say a thing about the rest of the code since isn’t formatted.

oh sorry I’m new to to forums

It seems that i can’t help you there. That syntax is from python 2 and i’m learning Python 3. Other than that, i think it would be helpful if you are more specific, like what error is throwing that code. About the else thing i stated in the last post, it should be the same regardless of Python version:

def some_function(parm1, parm2):
    if something:
        do whatever
        do another thing

Indentation is pretty important in Python. I hope it helps.

I had fix the indentation ( i think) but when i run it nothing happens. no errors or anything