当前位置:网站首页>Can the variable name be in Chinese? Directly fooled people
Can the variable name be in Chinese? Directly fooled people
2022-07-25 14:06:00 【Ride Hago to travel】
This is how it started 
morning , Xiaobian went to the library to study as usual , When passing by a girl , Just took a look , Found that she was also learning python, But the two lines of code presented on the screen directly confused people ! The contents are as follows :
User input = input(' Please enter the content :')
print( User input )

Wanted ,python Chinese can do variable names ?

In fact, I really wanted to tell her about this problem at that time , But I'm afraid I'm weak in talent and learning , What if it really works ? therefore , I found a small corner where there was no one , Prepare to try it yourself !
I took the two lines of code intact , Found that it really works , Because I have never done this before !
But I still don't believe it , I also tested the following code
①
character string = ' Next to the Lao wang '
Tuples = (' ha-ha ', ' Hee hee ', ' Hello ', ' Yes ')
list = [' ha-ha ', ' Hee hee ', ' Hello ']
Dictionaries = {
' full name ': ' Lao Wang ', ' Age ': ' Twenty five years old ', ' Gender ': ' male '}
aggregate = {
' Two ha ', ' Alaska ', ' Samoye '}
print( character string )
print( Tuples )
print( list )
print( Dictionaries )
print( aggregate )
Next to the Lao wang
(' ha-ha ', ' Hee hee ', ' Hello ', ' Yes ')
[' ha-ha ', ' Hee hee ', ' Hello ']
{
' full name ': ' Lao Wang ', ' Age ': ' Twenty five years old ', ' Gender ': ' male '}
{
' Two ha ', ' Samoye ', ' Alaska '}
②
Lao Wang's age = 18
User input = input(' Please enter the age of Lao Wang you guessed :')
if int( User input ) == Lao Wang's age :
print(' Congratulations on your guesses !!!')
elif int( User input ) > Lao Wang's age :
print(' Your guess is too old !!')
else:
print(' Your guess is younger !!!')
Please enter the age of Lao Wang you guessed :23
Your guess is too old !!

Even though pycharm The color shown in is not quite right , But there is no problem in operation .
So here comes the question , Is this really the right thing to do ?
The answer is No , Don't fit . Not to mention anything else , In the process of compiling the above code by Xiaobian himself , feel , The frequency of switching input method is significantly increased ! In fact, this is only secondary !
The main thing is here → Xiaobian is here to remind you ,python Do not name the variable name in Chinese ( Pinyin is not suitable ), Don't name it in Chinese ( Pinyin is not suitable ), Don't name it in Chinese ( Pinyin is not suitable , Try not to appear Chinese in the code )!!! Name in English , It's best to see the famous uprising , Let others guess at a glance , About what it means !( Such as : Name name, Age use age And so on )
because python In recent years, the popularity has been increasing , Also more and more robust , flexible , Efficient , But don't misinterpret it by naming variables in Chinese ’ Uncle GUI ‘ The original intention of !
边栏推荐
- Common problems of wireless relay acquisition instrument
- CDA level1 multi topic selection
- NoSQL, relational database, row and column database comparison and analogy
- The practice of depth estimation self-monitoring model monodepth2 in its own data set -- single card / multi card training, reasoning, onnx transformation and quantitative index evaluation
- LabVIEW的内部错误
- What financial products can I invest with some money in my hand?
- Stay on Alibaba cloud mqtt IOT platform
- 飞沃科技IPO过会:年营收11.3亿 湖南文旅与沅澧投资是股东
- [force buckle] 645. Wrong set
- 应急科普|收好这份暑期安全指南,让孩子安全过暑假!
猜你喜欢

Experiment the Arduino code of NTP network timing alarm clock with esp32+tm1638

Amd epyc 9664 flagship specification exposure: 96 core 192 threads 480MB cache 3.8ghz frequency

NUC980 设置SSH Xshell连接

ADB connects to Xiaomi mobile phone via Wi Fi

Tm1637 four digit LED display module Arduino driver with second dot

Leetcode -- addition of four numbers II

Workplace "digital people" don't eat or sleep 007 work system, can you "roll" them?

Internal error of LabVIEW

Hyperautomation for the enhancement of automation in industries

Emergency science | put away this summer safety guide and let children spend the summer vacation safely!
随机推荐
Teach you how to apply for SSL certificate
Alibaba mqtt IOT platform "cloud product circulation" practice - the two esp32 achieve remote interoperability through the IOT platform
Tm1638 LED digital display module Arduino drive code
AI model risk assessment Part 1: motivation
Working principle of Lora to 4G and gateway repeater
NoSQL, relational database, row and column database comparison and analogy
Business analysis report and data visualization report of CDA level1 knowledge point summary
Interpretation of featdepth self-monitoring model for monocular depth estimation (Part I) -- paper understanding and core source code analysis
IDEA设置提交SVN时忽略文件配置
What should I do if the high-level MySQL server cannot be installed and I forget the password (MySQL 8.0.29)?
Data analysis interview records 1-5
Namespaces and libraries
MySQL 01: Source command
CDA level1 double disk summary
Experiment the Arduino code of NTP network timing alarm clock with esp32+tm1638
Goldfish rhca memoirs: cl210 management storage -- object storage
leetcode202---快乐数
What are the ranking strategies for mobile websites, independent apps and websites?
华为ensp路由器静态路由(默认路由的下一跳地址)
手里有点钱可以投资哪些理财产品?