Python Learning the first article

Source: Internet
Author: User

Last week, I signed up for the reboot Python course, and finally made up my mind to get python done, hoping that I could stick with it and get the results I wanted.

#coding: utf-8# The user enters a name and score and saves it to the list. If the input is empty, print and end the loop. and calculate the average list1=[]count=0num=0while true:x=raw_input (' Please input your name: ') y=raw_input (' Please input your grade: ') if Y . IsDigit () and X.isalpha (): list1.append (int (y)) list1.append (str (x)) count+=1 num=int (num) +int (y) elif len (x) ==0 or Len (y) ==0:avg=num/count print list1 break else:print ' input is error ' print ' average is%s '% (avg)


This article from "Do not abandon!" Do not give up "blog, declined reprint!"

Python Learning the first article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.