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

How to input three numbers to calculate the average by python

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces the relevant knowledge of "python how to input three numbers to calculate the average". The editor shows you the operation process through the actual case, the operation method is simple and fast, and the practicality is strong. I hope this article "how to input three numbers to calculate the average value of python" can help you solve the problem.

The operating environment of this tutorial: windows7 system, Python 3.9.1 Dell G3 computer.

1. The idea of finding the average value

Receive the input string, take the space as the separator, store the segmented data in the lst1, store the data in the lst1 in another empty list (lst), and convert the string into an integer when it is stored, thus using the function to obtain the peaceful mean in the lst.

2. Examples

Print ("- average, you can enter any number -") lst = [] # define an empty list str = raw_input ("Please enter a numeric value, separated by a space:") lst1 = str.split (") # lst1 is used to store the input string, dividing I = 0while I with spaces

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