Python Case 2

Source: Internet
Author: User
‘‘‘
The introduction of lucky draw in the shopping malls according to the lottery Rules calculation membership card number and the realization of the idea:
(1) receive the entered membership card number (4 digits)
(2) Decomposition to obtain the figures
(3) Calculate the sum of your figures
‘‘‘
Import Random
Randomnum=random.randint (0,36)
Num=int (Input ("Please enter the card number:"))
N1=num%10
Num=num//10
N2=num%10
Num=num//10
N3=num%10
Num=num//10
N4=num
S=n1+n2+n3+n4
Print ("Numbers obtained:%s%s%s%s"% (N4,N3,N2,N1))
Print ("Sum of Members Numbers:%s"%s)
Print ("Winning number:%s"%randomnum)
If S==randomnum:
Print ("Congratulations, the jackpot!" ")
Else
Print ("Thank you for participating!" ")
Operation Result:

Python Case 2

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.