Write a program to count the numbers divided by 7 between 1-150
Answers
y 26 2020 08:09:19 (UTC/GMT +8 hours)
Python Conditional: Exercise-1 with Solution
Write a Python program to find those numbers which are divisible by 7 and multiple of 5, between 1500 and 2700 (both included).
Pictorial Presentation:
Python Exercise: Find numbers which are divisible by 7 and multiple of 5 between a range
Sample Solution:
Python Code:
nl=[]
for x in range(1500, 2701):
if (x%7==0) and (x%5==0):
nl.append(str(x))
print (','.join(nl))
Copy
Sample Output:
1505,1540,1575,1610,1645,1680,1715,1750,1785,1820,1855,1890,1925,1960,1995,2030,2065,2100,2135,2170,2205,2240,
2275,2310,2345,2380,2415,2450,2485,2520,2555,2590,2625,2660,2695
Flowchart:
Flowchart: Python program to find numbers which are divisible by 7 and multiple of 5 between a range
Visualize Python code execution:
The following tool visualize what the computer is doing step-by-step as it executes the said program:
Python Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: Python Conditional Statements and Loops Exercises Home
Next: Write a Python program to convert temperatures to and from celsius, fahrenheit.
What is the difficulty level of this exercise?
EASY MEDIUM HARD
Based on 874 votes, average difficulty level of this exercise is Easy .
Test your Python skills with w3resource's quiz
Python: Tips of the Day
Python: Combining a list of strings into a single one
sentence_list = ["my", "name", "is", "George"]
sentence_string = " ".join(sentence_list)
print(sentence_string)
New Content published on w3resource :
Python Numpy exercises
Python GeoPy Package exercises
Python Pandas exercises
Python nltk exercises
Python BeautifulSoup exercises
Form Template
Composer - PHP Package Manager
PHPUnit - PHP Testing
Laravel - PHP Framework
Angular - JavaScript Framework
React - JavaScript Library
Vue - JavaScript Framework
Jest - JavaScript Testing Framework
by TaboolaSponsored LinksYou May Like
Born Between 1965-1985? Get Term Life Insurance Worth ₹1 Cr at Rs.1884/month*.
Term Plans -Compare & Buy Now!
Protect Yourself and your Family and Friends From mosquitoes, rats, lizards, rats, flies, cockroaches.
Pest Safe Device
Do You Speak English? Work a USA job from home in India
Work from Home | Search Ads
Jhunjhunu: Work-From-Home In The US May Pay You More Than You Think!
Work Online USA | Search Ads
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
©w3resource.com 2011-2020
PrivacyAboutContactFeedbackAdvertise
Answer:
CHECK OUT MY SOLUTION, DUDE
public class count {
public static void main(String[] args) {
int times = 0;
for(int i = 1; i <= 150; i++) {
if(i%7==0)
times++;
}
System.out.println("There are "+times+" times");
}
}
Explanation:
MARK ME BRAINLIEST IF IT HELPS YOU!