Ques 1) Write a program to display all prime odd numbers within a range using FOR loop.
Ques 2) Write a python program to accept price of an item and number of quantities sold. If
quantity sold is more than 500, then give them a discount of 10%. If quantity sold is less
than or equal to 500 or more than 250, then give them a discount of 5%. Finally display the
amount payable.
PLS HELP ME AS SOON AS POSSIBLE
I'll mark the correct answer as brainliest.
Answers
Answered by
0
Answer: 1. Given starting and end points, write a Python program to print all odd numbers in that given range.
Example:
Input: start = 4, end = 15
Output: 5, 7, 9, 11, 13, 15
Input: start = 3, end = 11
Output: 3, 5, 7, 9, 11
Example #1: Print all odd numbers from given list using for loop
Define start and end limit of range. Iterate from start till the range in the list using for loop and check if num % 2 != 0. If the condition satisfies, then only print the number.
# Python program to print odd Numbers in given range
start, end = 4, 19
# iterating each number in list
for num in range(start, end + 1):
# checking condition
if num % 2 != 0:
print(num, end = " ")
Explanation:
Similar questions