当前位置:网站首页>Day3 data type and Operator jobs
Day3 data type and Operator jobs
2022-06-26 04:59:00 【The story of Ula】
day3 Data types and Operator jobs
choice question
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 (C,D).
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
Completion
- 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 statementx += 6
after ,x The value of is (9). - expression
3 ** 2
The value of is (9), expression3 * 2
The value of is (6), expression4 ** 0.5
The value of is (2.0).
Programming questions
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. print(num % 7 == 0 and num % 3 == 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. print((num % 7 == 0 or num % 3 == 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 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 = 15678 hour = time // 3600 minuta = time % 3600 // 60 second = time % 60 print('{} when {} branch {} second '.format(hour, minuta, 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 weight = int(input(' Please enter the weight :')) height = float(input(' Please enter height ( rice ):')) BMI = weight / (height ** 2) print(18.5 <= BMI <= 24.5)
Short answer
Python What are the built-in data types ?
- int( integer )
- float( floating-point )
- complex( The plural )
- bool( Boolean type )
- str( character string )
- list( list )
- dict( Dictionaries )
- set( aggregate )
- tuple( Tuples )
Write your thoughts about today ⽇ Where there are questions in the teaching content of the day ⽅ Fang ( Or knowledge points that feel difficult ).
nothing
边栏推荐
- UWB超高精度定位系统架构图
- torchvision_ Transform (image enhancement)
- Comment enregistrer une image dans une applet Wechat
- Differences between TCP and UDP
- UWB ultra high precision positioning system architecture
- Collections and dictionaries
- Nabicat连接:本地Mysql&&云服务Mysql以及报错
- [H5 development] 03- take you hand in hand to improve H5 development - single submission vs batch submission with a common interface
- 5. <tag-栈和常规问题>补充: lt.946. 验证栈序列(同剑指 Offer 31. 栈的压入、弹出序列)
- Difference between return and yield
猜你喜欢
Use of better scroll
A new paradigm for large model application: unified feature representation optimization (UFO)
6.1 - 6.2 公鑰密碼學簡介
torchvision_ Transform (image enhancement)
为什么许多shopify独立站卖家都在用聊天机器人?一分钟读懂行业秘密!
Dameng database backup and restore
A method of quickly transplanting library function code to register code by single chip microcomputer
ROS notes (07) - Implementation of client and server
Use fill and fill in Matplotlib_ Between fill the blank area between functions
1.11 learning summary
随机推荐
Condition query
LeetCode 19. 删除链表的倒数第 N 个结点
Numpy random number
Numpy data input / output
0622-马棕榈跌9%
2022.2.11
2022.1.23
ModuleNotFoundError: No module named ‘numpy‘
Anti withdrawal test record
1.12 learning summary
Hash problem
ROS notes (07) - Implementation of client and server
Basic query
Difference between return and yield
6.1 - 6.2 公钥密码学简介
Datetime data type ---now() gets the current time, datetime() creation date, performs mathematical operations, and to_ Datetime() converts to date type and extracts various parts of date
PSIM software learning ---08 call of C program block
Record a circular reference problem
A ZABBIX self discovery script (shell Basics)
Introduction to classification data cotegory and properties and methods of common APIs