Lesson 3 python Judgment and nested conditions

Recall 1,2 class. . . . . What we learned

  1. print () ### show him what you want, he will show what print ( "Hello, World") ----- attention to the English "
  2. Variable name = "Pig"
  3. python three data types: str, int, float

This time we really judge. . . if it is not too fast? Not to engage in things, where there is something to learn. . . (C many data types, SQL, too, python is relatively small, at least my first learning of language is python, you do not come up for the list, str, dict these is not it? You do not find that these are the three types of primary data types packaged inside it? format written only difference)

If we begin to judge it. . .

Before we begin, we look back to learn the function of internal

print ( "You must know your friends') ---- print to the screen (output)
of the type (" Hello World ") ----- see what data type Yes. . .
input ( "Please enter what you think:") ----- input. An output, there must be an input (received, a variable B is normally mounted essential, .... try to python3 are strings.

name = input ( "Please enter what you think:")
Print (name)
Print (of the type (name))

### add python writing specifications: the same level of alignment, the next level of four empty spaces. (Tab key ritual was too !!! If you just use your computer, which I often replaced linux, windows loaded to force up all kinds of error, of course, now have a special tool to convert;? Beginner or practical point bar)

----- unidirectional determination. . . (If .... on ....), buy a house as an example, 80W will be the down payment

money = 80

Money IF> = 80:
Print ( "enough down payment, you do not get married")

If the 70 ### it? Yes, without any prompting ......

----- bi judgment. . . (If it .... otherwise ...)

money = 60

Money IF> = 80:
Print ( "enough down payment,")
the else:
Print ( "dead beast ... minute not break it.")

### is not, not very friendly. . . . If there are 60W it. . Trying to be a down payment you, it is not too poor. . .

----- multi judgment. . . Finally optimization. . . . . So be it.
money = 60

Money IF> = 80:
Print ( "enough down payment,")

0 elif <Money <80:
Print ( "also did a little work hard it.")

else:
   print("死穷鬼。。。分都不分一下")

################################################## ########
judge basically completed, note writing, is not very simple. . . . Yes, it's that simple. . .

If the embedded, how to deal with?

58 = a
## to interact with, the following modify
a = input ( "Your test scores")
### is not a very friendly, I have this bad habit is not good, it should be a score = input ( ), a error-free, but other people take over your program, deceptive.

A IF> 60:
Print ( "greater than 60, excellent matter, pass the test")

the else:
IF 50 <A <= 59:
Print ( "there is a chance to make-up")
the else:
Print ( "et rattan pork stew")

Guess you like

Origin blog.51cto.com/323248/2425776