Академический Документы
Профессиональный Документы
Культура Документы
com)
C Programming Examples
Java Algorithms
C++ Algorithms
C Algorithms
Python Program to Find all Numbers in a Range which are Perfect Squares and Sum of all Digits in the
Number is Less than 10
This is a Python Program to create a list of of all numbers in a range which are perfect squares and the sum of the digits of the number is less than 10.
Problem Description
The program takes a range and creates a list of all numbers in the range which are perfect squares and the sum of the digits is less than 10.
Problem Solution
1. User must enter the upper and lower range for the numbers.
2. A list must be created using list comprehension where the element is a perfect square within the range and the sum of the digits of the number is less than 10.
3. This list must then be printed.
4. Exit.
Program/Source Code
Here is source code of the Python Program to create a list of of all numbers in a range which are perfect squares and the sum of the digits of the number is less than 10. The
program output is also shown below.
Program Explanation
1. User must enter the upper and lower range for the numbers.
2. List comprehension must be used to create a list of numbers which are perfect squares and sum of the digits is less than 10.
3. The second part of the list comprehension first maps separate digits of the number into a list and finds the sum of the elements in the list.
3. The list which is created is printed.
Case 1:
Enter lower range: 1
Enter upper range: 40
[1, 4, 9, 16, 25, 36]
Case 2:
Enter lower range: 50
Enter upper range: 100
[81, 100]
To practice all Python programs, here is complete set of 150+ Python Problems and Solutions (http://www.sanfoundry.com/python-problems-solutions/).
Prev Page - Python Program to Find the Largest Number in a List (http://www.sanfoundry.com/python-program-find-largest-number-list/)
Next Page - Python Program to Find the Union of two Lists (http://www.sanfoundry.com/python-program-find-union-two-lists/)
Deep Dive @ Sanfoundry:
1. C Programming Examples on Bitwise Operations (http://www.sanfoundry.com/c-programming-examples-bitwise-operations/)
2. C# Programming Examples on Conversions (http://www.sanfoundry.com/csharp-programming-examples-on-conversions/)
3. C Programming Examples on Puzzles & Games (http://www.sanfoundry.com/c-programming-examples-on-puzzles-games/)
4. C# Programming Examples on Strings (http://www.sanfoundry.com/csharp-programming-examples-on-strings/)
5. C# Programming Examples on Matrix (http://www.sanfoundry.com/csharp-programming-examples-on-matrix/)
6. C Programming Examples on Matrix (http://www.sanfoundry.com/c-programming-examples-matrix/)
7. Python Questions and Answers (http://www.sanfoundry.com/1000-python-questions-answers/)
8. C# Programming Examples on Arrays (http://www.sanfoundry.com/csharp-programming-examples-on-arrays/)
9. Simple C Programs (http://www.sanfoundry.com/simple-c-programs/)
10. Python Programming Examples (http://www.sanfoundry.com/python-problems-solutions/)
Manish Bhojasia (http://www.sanfoundry.com/about/), a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at
Sanfoundry. He is Linux Kernel Developer and SAN Architect and is passionate about competency developments in these areas. He lives in
Bangalore and delivers focused training sessions to IT professionals in Linux Kernel, Linux Debugging, Linux Device Drivers, Linux
Networking, Linux Storage & Cluster Administration, Advanced C Programming, SAN Storage Technologies, SCSI Internals and Storage
Protocols such as iSCSI & Fiber Channel. Stay connected with him below:
LinkedIn (http://www.linkedin.com/in/manishbhojasia) | Facebook (http://www.facebook.com/sanfoundry) | Twitter
(http://www.twitter.com/sanfoundry) | Google+ (https://plus.google.com/104408026570656234343/posts)
Name*
Email*
Subscribe
Best Careers
Best Coaching
Institute
Sanfoundry is No. 1 choice for Deep Hands-ON Trainings in SAN, Linux & C, Kernel Programming. Our Founder has trained employees of almost all Top Companies in
India such as VMware, Citrix, Oracle, Motorola, Ericsson, Aricent, HP, Intuit, Microsoft, Cisco, SAP Labs, Siemens, Symantec, Redhat, Chelsio, Cavium, ST-Micro,
Samsung, LG-Soft, Wipro, TCS, HCL, IBM, Accenture, HSBC, Mphasis, Tata-Elxsi, Tata VSNL, Mindtree, Cognizant and Startups.
Best Trainings
India Internships
About Sanfoundry
About Us (http://www.sanfoundry.com/about/)
Copyright (http://www.sanfoundry.com/copyright/)
TOS & Privacy (http://www.sanfoundry.com/tos-privacy-policy/)
Jobs (http://www.sanfoundry.com/jobs/)
Bangalore Training (http://www.sanfoundry.com/coursesfees/)
Online Training (http://www.sanfoundry.com/online-training-san-linux-kernel-device-drivers/)
SAN Training (http://www.sanfoundry.com/san-storage-area-networks-training/)
Developers Track (http://www.sanfoundry.com/salary-50l/)
Mentoring Sessions (http://www.sanfoundry.com/professional-mentoring-coaching-career-guidance-cto/)
Contact Us (http://www.sanfoundry.com/contact/)
Sitemap (http://www.sanfoundry.com/sitemap_index.xml)
2011-2017 Sanfoundry