What the saved data can do , Variables can be done
print(12) And a=12;print(a)
print(13+12) And a=13;b=12;print(a+b)
Multiple variables define the same value
Variable 1= Variable 2= Variable 3= data
Multiple variables define different values
Variable 1, Variable 2= data 1, data 2 ( The number of variables must be consistent with the number of data )
adopt input The data type of operation input is string str
Some floating-point numbers cannot be represented as multiple 2 The form of the sum of powers , As a result, it cannot be accurately stored
print(100 - 25 * 3 % 4)
What should be output ? (B)
A. 1
B. 97
C. 25
D. 0
Which of the following statements is wrong (A).
A. Except for dictionary types , All standard objects can be used for Boolean testing
B. The Boolean value of an empty string is False
C. The Boolean value of an empty list object is False
D. The value is 0 The Boolean value of any numeric object of is False
Python Unsupported data types are (A).
A. char
B. int
C. float
D. list
( multi-select )n = 6784, You can get 7 The way to do this is (CD).
A. n / 1000 % 100
B. n % 1000 / 100
C. n // 100 % 10
D. n // 10 % 100 // 10
Run the following program , When entering... From the keyboard 12, The result of the operation is (A).
x = (input())
print(type(x))
A. <class 'str'>
B. <class 'int'>
C. error
D. class 'dict'
The operation result of the following expression is ( D ) .
a = 100
b = False
print(a * b > -1)
A. False
B. 1
C. 0
D.True
stay Python The empty type is (None).
The function name to view the type of data in the variable is (type).
It is known that x = 3 == 3
, After execution , Variable x The value of is (True).
It is known that x = 3
, Then execute the statement x += 6
after ,x The value of is (9).
expression 3 ** 2
The value of is (9), expression 3 * 2
The value of is (6), expression 4 ** 0.5
The value of is (2.0).
Write to determine whether a number can be simultaneously 3 and 7 Divisible conditional statement , And print the corresponding results .
for example : Input 21 Print True, Input 9 Print False.
num = int(input(' Please enter a number :'))
print(num%21 == 0)
Write to determine whether a number can be 3 perhaps 7 to be divisible by , But not both 3 perhaps 7 Divisible conditional statement , And print the corresponding results .
for example : Input 14 Print True, Input 4 Print False, Input 21 Print False.
num = int(input(' Please enter a number :'))
print((num%3 == 0 or num%7==0)and not num%21==0)
Enter year , Write code to judge whether the entered year is a leap year , And print the corresponding results .( It's a leap year condition : Can be 4 Divisible but not by 100 Divisible or capable of being divisible by 400 Divisible year )
for example : Input 2020 Print True, Input 2011 Print False
year=int(input(' Please enter the year :'))
print((year%4==0 and year%100!=0) or year%400==0)
Suppose today's class time is 15678 second , Programming to calculate the class time today is how many hours , How many minutes? , How many seconds ; With ‘XX when XX branch XX second ’ It's expressed in a different way .
for example : Time 67 second —> 0 when 1 branch 7 second
time_1=int(input(' Today's class is '))
hours=time_1//3600
mins=(time_1%3600)//60
sec=time_1%60
print(hours,' when ',mins,' branch ',sec,' second ')
Define two variables to save a person's height and weight , Programming to determine whether the person's body is normal !
The formula : weight (kg)/ height (m) The square value of
stay 18.5 ~ 24.9 It's normal .
for example : Enter the weight : 55, Enter the height :1.55, Output : True
high=float(input(' Please enter height (m):'))
weight=float(input(' Please enter the weight (kg):'))
bmi=weight/high**2
print(18.5<=bmi<=24.9)
Python What are the built-in data types ?
Write your thoughts about today ⽇ Where there are questions in the teaching content of the day ⽅ Fang ( Or knowledge points that feel difficult ).
nothing