It's not Delphi is rigorous,
Import the random
N=random. Randint (# 1, 101) using the random module in the randint randomly generated an integer between 1 ~ 100
The count=0
While the count & lt; 4:
Num=input (" please enter the number:)
Try: # using try... Except statement: if the input is not a number, then use the int () conversion occurs ValueError error
Num=int (num)
If num & gt; N:
Print (" -- -- -- you input number is too big - ')
Elif num & lt; N:
Print (" -- -- -- you input number is too small - ')
Elif num==n:
Print (' - congratulations you guessed it - ')
Break
Print (' second chance - you have % s' % (3 - count))
Count +=1
Except, ValueError: # capture ValueError error
Print (" -- -- -- - please enter a valid content ')
The continue
The else:
Print (' - your chance has finished - ')
CodePudding user response:
While the count & lt; 4:Try:
I=int (input (' please enter the number:))
If I & gt; N:
.
Print (' - the number of overrun! - ')
Except, ValueError:
Print (' input, please enter the number! ')
Print (' 5555! ')////this inside the loop?
Print (' 12345! ')////if you want to jump out of the loop body must be in the wrong line forward writing code? Ha, ha, ha, a bit mean
CodePudding user response:
Not ah, grammar is very good readCodePudding user response: