I get this message when running my python in cmd "Indentation error expected an indented block expected" -
import random import time name=input("welcome game name") print(("this numbers game"),(name), ("you playing against computer")) print ("the idea of game closer computer 21 without going on 21") ,ready="n" ready = input("are ready play game?").lower if ready == "yes" or ready =="y": score=0
the error coming , saying line above while(score)<21 and(ready=="y" or ready == "yes" or ready =="yes" or ready ==
"yes" or ready =="y"): player1=random.randint(1,21) score=(score+player1) time.sleep(3) print(("you have scored"),(score)) if score<21: ready=input("do want add more score") if score>21: print("sorry on 21 went bust computer wins") else: print("ok done lets see computer gets")
(ignore line please) computerscore=0 while(computerscore)<21 , (computerscore)<(score): computer=random.randint(1,21) computerscore=(computerscore+computer)
time.sleep(3) print(("the computer has scored"),(computerscore)) if(computerscore)<=21 , (computerscore)>(score): print("sorry computer wins") else: print("you win done") break
i ran in cmd
you have indent blocks after conditions lines, that's how python understands if you're still in condition or not.
if a>b: print b print "i'm still in case a>b" else: print
use tab or 4 spaces indent.
Comments
Post a Comment