Python: Some simple exercises (1)

Source: Internet
Author: User

1. Enter a number from 1 to the number of all 10-digit and single-digit combinations and the number of such numbers:

n = 0x = input (' Please enter Number: ') for item in range (1, int (x)): For    item2 in range (1, int (x)):        If Item = = item2:            pass
  else:            item3 = str (item) + str (ITEM2)            print (int (item3))            n + = 1print (' compliant number is: ', n ')

2.9*9 the output of the multiplication table:

For item1 in range (1, ten): for    item2 in range (1, item1 + 1):        item3 = item1 * item2        print (str (item1) + ' * ' + s TR (item2) + ' = ' + str (item3), end= '    )    print (' \ n ', end= ')

Python: Some simple exercises (1)

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.