Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Case study of python Operation

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "case study of python practice". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn the "python practical case study"!

If you think about it first when you see this, how can you output him?

Why does it have color?

Where can I find special symbols?

Special symbols look for symbols in the Book of symbols.

Http://www.fhdq.net/ task 1, output book information book_name='Java programming course 'publish=' Xi'an University of Electronic Science and Technology Press' pub_date='2019-02-02'price=56.8print ('►→→◀') print ('▷\ t\ t', book_name,' "\ t ◁') print ('▷\ t Press:' Publish,'\ t ◁') print ('▷\ t publication time:', pub_date,'\ t\ t\ t ◁') print ('▷\ t pricing:', price,'\ t\ t ◁') print ('►→→◀')

Achieve results:

►→→◀

▷ "Java programming tutorial" ◁

▷ Press: ◁, Xi'an University of Electronic Science and Technology Press

▷ publication time: 2019-02-02 ◁

▷ pricing: 56.8 ◁

►→→◀

Task 2. Output the top five of Jinling in A Dream of Red Mansions. 1. Assignment of variables name1=' Lin Daiyu 'name2=' Xue Baochai' name3=' Jia Yuanchun 'name4=' Jia Tanchun' name5=' Shi Xiangyun 'print (' ➀\ t'+name1) print ('➁\ t'+name2) print (' ➂\ t'+name3) print ('➃\ t'+name4) print (' ➄\ t'+name5)

Running result:

➀Lin Daiyu

➁ Xue Baochai

➂ Jia Yuanchun

➃ Jia Tanchun

➄ Shi Xiangyun

2. List method lst_name= ['Lin Daiyu', 'Xue Baochai', 'Jia Yuanchun', 'Jia Tanchun', 'Shi Xiangyun'] lst_sig= ['➀', '➁', '➂', '➃', '➄'] for i in range (5): print (lst_ sign [I], lst_ name [I])

If there is no [I], the array will be output directly:

➀Lin Daiyu

➁ Xue Baochai

➂ Jia Yuanchun

➃ Jia Tanchun

➄ Shi Xiangyun

3. Dictionary mode d = {'➀': 'Lin Daiyu', '➁': 'Xue Baochai', '➂': 'Jia Yuanchun', '➃': 'Jia Tanchun' '➄': 'Shi Xiangyun'} print (''-'') for key in d: print (key D [key]) print ('zip--') for smagnamename in zip (lst_sig,lst_name): print (sMagneName)

Running result:

➀Lin Daiyu

Zip--

➁ Xue Baochai

Zip--

➂ Jia Yuanchun

Zip--

➃ Jia Tanchun

Zip--

➄ Shi Xiangyun

Zip--

➀Lin Daiyu

➁ Xue Baochai

➂ Jia Yuanchun

➃ Jia Tanchun

➄ Shi Xiangyun

Task 3: output books, audio and video medals

There are colors:

Print (\ 033 [0bot 35m\ t\ t Book Audio and Video Medal\ 033 [m') print ('\ 033 [0bot 35m -\ 033 [m') print (\ 0033 [0bot 32m ❀Book Audiovisual Medal\ t\ t audio\ t exclusive activities\ 033 [m') print ('0033 [0] 34m ❤ exclusive offer\ t\ t ☏\ t discount reminder\ 033 [m') print ('033 [0bot 35m -\ 033 [m')

Task 4. Output your physical indicators

Calculate BMI based on height and weight

Height=170weight=50.5bmi=weight/ (height+weight) print ('your height is:', height) # print ('your weight is: + str (weight)) print (' your weight is:', weight) print ('your BMI index is:', bmi)

Your height is: 170

Your weight is: 50.5

The index of your BMI is 0.2290249433106576

Format decimals:

Print ('your BMI index is:' +'{: 0.2f} '.format (bmi))

The index of your BMI is 0.23.

At this point, I believe you have a deeper understanding of the "python case study", you might as well come to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report