Professional Documents
Culture Documents
Implement a Python program that calculates the electricity bill for a household.
Ask the user to enter the number of units consumed in a month and calculate
the bill based on the following rates:
- For the first 100 units: $0.10 per unit
- For the next 200 units: $0.15 per unit
- For the remaining units: $0.20 per unit
- Add a fixed service charge of $10.00
- Print the total bill.
Create a Python program that calculates the sum of all numbers between 1 and
100 that are divisible by both 3 and 5. (For loop)
Create a Python program that asks the user for a password. If the password is
"secret," print "Access granted." Otherwise, print "Access denied." Use while
loop.
Write a Python program that prints a pattern of stars in the shape of a right-
angled triangle. Ask the user for the height of the triangle and print the pattern
accordingly. (both For loop and while loop)
Write a Python program that calculates the sum of all the even numbers
between 1 and a user-specified positive integer "n" using a while loop.
You are creating a decision-making flowchart for a simple game. In the game,
the player must guess a random number between 1 and 100. If the player's
guess is too low, they receive a "Too low" message. If the guess is too high,
they receive a "Too high" message. If the guess is correct, they win the game.
Create a flowchart outlining the game logic.