Home > Back-end >  Grammar is a mess beginners python, how to feel?
Grammar is a mess beginners python, how to feel?

Time:11-05

Python BBS see a simple example of how chaotic feeling grammar? Circulation, interrupt, continue to of have a little puzzling,
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 read

CodePudding user response:

mountain heart bean references 2 floor response:
no, grammar is very good reading

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! ')
Print (' 12345! ')
Written so confused, Delphi writing is no problem, and it also can tell circulation inside and outside the

CodePudding user response:

Well, PYTHON is to be in good format, Delphi has begin, end, more casual,
  • Related