Question

Question 1: Write a python program that finds all numbers divisible by 7 but not multiple...

Question 1: Write a python program that finds all numbers divisible by 7 but not multiple of 5. The range of number for searching is between 2000 and 3200 (both included). Output should be printed in a comma-separated sequence on a single line .

0 0
Add a comment Improve this question Transcribed image text
Answer #1

X La *cj.py - C:\Users\Basheer\Desktop\cj.py (3.7.4)* - O File Edit Format Run Options Window Help n=[] #take n as empty list

Le Python 3.7.4 Shell - O X File Edit Shell Debug Options Window Help Python 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 19:29

CODE:

n=[] #take n as empty list
for x in range(2000,3201): #take range from 2000 to 3200
if(x%7==0) and(x%5!=0): # condition divisible of 7 and not multiple of 5
n.append(str(x)) #append to empty list n
print(','.join(n)) #print separated with single line

Add a comment
Answer #2

num=[]

for i in range(2000,3200):

    if(i%7==0) and (i%5!=0):

        num.append(i)

print(num)        


answered by: Shahzain Hussain
Add a comment
Know the answer?
Add Answer to:
Question 1: Write a python program that finds all numbers divisible by 7 but not multiple...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a program in python using lists or tuples that asks for two positive integers n1...

    Write a program in python using lists or tuples that asks for two positive integers n1 and n2 and prints out all the numbers that are divisible by 7 but are not a multiple of 5 within the range [n1,n2] (both included). The numbers obtained should be printed in a comma-separated sequence on a single line.

  • use python to print numbers which are divisible by 7 and multiple of 5, between 1500...

    use python to print numbers which are divisible by 7 and multiple of 5, between 1500 and 2700 (both included). NOTE: use a while loop and for loop at different time

  • 8.(a) Write a program that prints all of the numbers from 0 to 102 divisible by...

    8.(a) Write a program that prints all of the numbers from 0 to 102 divisible by either 3 or 7. ​ (b) Write a program that prints all of the numbers from 0 to 102 divisible by both 3 and 7 (c) Write a program that prints all of the even numbers from 0 to 102 divisible by both 3 and 7 (d) Write a program that prints all of the odd numbers from 0 to 102 divisible by both...

  • python format: write a program that displays, 10 numbers per line, all the numbers from 100...

    python format: write a program that displays, 10 numbers per line, all the numbers from 100 to 200 that are divisible by 5 or 6, but not both. The numbers are separated by exactly one space My Code: count = 0 for i in range (100, 201):     if (i %6==0 and i %5!=0) or (i%5==0 and i%6!=0):         print(str(i), "")         count = count + 1     if count == 10:         string = str(i) + str("")         print(string)...

  • Write a python program: Ask for the encryption key. The key must be a list of...

    Write a python program: Ask for the encryption key. The key must be a list of numbers between 0 and N-1, where N is the number of entries in the key's list; for example, 5,4,3,2,1,0 has six numbers, and each digit 0-5 appears in the list. Asks for a line of text to encrypt. Use the transposition key to transpose each chunk of N letters in input text. If the input text is not a multiple of the key length,...

  • Write a python program that uses a while loop to print numbers 100,98,96... all the way...

    Write a python program that uses a while loop to print numbers 100,98,96... all the way to 0. each number should be printed on a seperate line

  • Write a C program that finds the odd, composite numbers between 10 and 500 in xterm...

    Write a C program that finds the odd, composite numbers between 10 and 500 in xterm a. Composite means it is not prime, i.e., “C” is composite if there exists an A and B such that A>1, B>1, and A*B = C. b. Odd means that it is not divisible by 2. c. Therefore “odd, composite”, means both odd and composite'' Output should be: 15 is a composite number. 21 is a composite number. 25 is a composite number. 27...

  • Question 4-6 Please. Python 3.6. def main(). entered by a user. Write a program that finds...

    Question 4-6 Please. Python 3.6. def main(). entered by a user. Write a program that finds the sum and average of a series of numbers he program should first prompt the user to enter total numbers of numbers are to be summed and averaged. It should then as for input for each of the numbers, add them, and print the total of the numbers and their average 2. Write a progra m that finds the area of a circle. The...

  • C programming question! Write a program that reads two numbers and finds the greater one. The...

    C programming question! Write a program that reads two numbers and finds the greater one. The input is two integers and the output will be a single line “The maximum of ? and ? is ?.”, where ? and ? are the input values and ? is the maximum of ? and ?. If ? and ? are equal, ? will be equal to both of them. Example of input: 10 20 Corresponding output: The maximum of 10 and 20...

  • write the solution of the program by python 3 language : I need the program using...

    write the solution of the program by python 3 language : I need the program using list or string or loops (while and for) or if,elif,else : Alex got a sequence of n integers a1,a2,…,an as a birthday present. Alex doesn't like negative numbers, so he decided to erase the minus signs from all negative numbers. As a result, he got a sequence of non-negative numbers. Print the resulting sequence. For example, if the sequence is  1, 5, -3, 4,...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT