Calculate the net salary of a worker. It is necessary to know hours worked, payment per hour to the worker and fixed discounts for gross work with tax (12% of gross salary). 120 Hours worked at a rate of 13.45 per hour.
Sum of all even numbers. The addition will be done using all the numbers between 2 and 100.
Display (print) the list of numbers from 1 to 100 whose value ends in 6. 4. Calculate the sum of the numbers from 1 to 1000.
Calculate the mean height of the following people:
Make a program where, when the user enters a number between 1 and 7, the program throws a message that indicates to which day that entered number corresponds, in addition, if the user enters a number that is not between 1 and 7, the program must ask enter another number between that range and when entering the number 9 the program closes.
Write a program that calculates the total owed by a customer at a restaurant.
The program should ask the customer to enter the charge for the food, then calculate the amounts of an 20 percent tip and 8 percent sales tax.
Display each of these amounts and the total in the following format:
The tip owed is $___.
The sales tax owed is $___.
The total amount owed is $___.
The output should be a multi-line string and ___ should be replaced by actual values in by your program output.
Write a program that prompts a user to enter a number between 1 and 100. If a number outside of this boundary is entered or if a non-number is entered, reply with an error message. Otherwise, determine whether the number if even or odd. Subsequently, print out a statement describing whether the entered number if even or odd.
The colors red, blue, and yellow are known as the primary colors because they cannot be made by mixing other colors. When you mix two primary colors, you get a secondary color, as shown here:
When you mix red and blue, you get purple.
When you mix red and yellow, you get orange.
When you mix blue and yellow, you get green.
Design a program that prompts the user to enter the names of two primary colors to mix. If the user enters anything other than a primary color (red, blue, or yellow), the program should display an error message. Otherwise, the program should display the name of the secondary color that results.
Write a while loop that lets the user enter a number. The number should be multiplied by 10, and the result assigned to a variable named product. The loop should iterate as long as the product is less than 100.
Write a for loop that displays the following set of numbers:
0, 10, 20, 30, 40, 50 . . . 100
Write a loop that asks the user to enter a number. The loop should iterate 10 times and keep a running total of the numbers entered.
Write a program that prints numbers starting at 20 and ending at 0. For every odd number, print "Buzz" instead of the number, and for every even number, print "Fizz" instead of the number.
Write a program with a loop that asks the user to enter a series of positive numbers. The user should enter a negative number to signal the end of the series. After all the positive numbers have been entered, the program should display the sum.
At one college, the tuition for a full-time student is $8,000 per semester. It has been announced that the tuition will increase by 3 percent each year for the next 5 years. Write a program with a loop that displays the projected semester tuition for the next 5 years.
Write a program that uses a nested loops to draw this pattern:
Write a program that prints out all numbers from list_a: [0,1,2,3,4,5] that do not have a corresponding number in another list_b: [1,3,5,7,9]. When a number in list_a is determined to not have a duplicate in list_b, print out "{num} is not in list_b".
For example: "0 is not in list_b"
list_a = [0,1,2,3,4,5]
list_b = [1,3,5,7,9]
Write a function named times_ten. The function should accept an argument and display the product of its argument multiplied by 10.
Write a program that asks a user to enter a distance in kilometers, then converts that distance to miles and prints it out.
The conversion formula is as follows:
# Miles = Kilometers x 0.6214
Write a function count_up that prints out a number up to and including the passed in parameter number.
The program should receive input from a user that will enter the amount to deposit into the piggybank. Use a function, add, which takes an argument number from the user input and adds it to a global sum variable. After the 5th deposit, print out the running total thus far.
Write a program that counts all the vowels in a string. The program should allow a user to enter a string input and print out a number response.
Write a function that accepts two string arguments: str and substr. The function should count the number of times the substr is in str and return that number.
Given this string: "Hello, my name is Joe. I love long walks in the park and staring at stars at night."
Write a program that prints out the following:
- The number of upper case letters in the string
- The number of lower case letters in the string
- The number of whitespace characters in the string
Write a program that asks the user to enter a series of single-digit numbers with nothing separating them.
The program should display the sum of all the single-digit numbers in the string.
For example, if the user enters 1234, the method should return 10, which is the sum of 1, 2, 3, and 4.
Design a program that generates an 8-digit passcode consisting of random numbers. The program should generate eight random numbers, each in the range of 0-9, and assign each number to a list. Then write another loop that displays the contents of the list.
A positive integer greater than 1 is said to be prime if it has no divisors other than 1 and itself. A positive integer greater than 1 is composite if it is not prime. Write a program that asks the user to enter an integer greater than 1, then displays all of the prime numbers that are less than or equal to the number entered. Once the user has entered a number, the program should populate a list with all of the integers from 2 up through the value entered. The program should then use a loop to step through the list. The loop should pass each element to a function that displays the element whether it is a prime number.
Given the following list and nested lists:
scores = [['Jack', 'Josh', 'Joe'],[90, 88, 56],[67, 88, 87],[88, 99, 78]]
Write a program that turns this into an ASCII art table with the scores in their correct places.
You may design the table however you like.
The nested lists are the rows and the indexes of the nested lists are the columns.
In the end, you should have a table with 4 rows (first one being the student names) and 3 columns (one for each student).
A grocery store has a reward system that gives customers redeemable points based on the amount spent on groceries.
The points are awarded as follows:
- If a customer spends <= $50, they are awarded 1 point for each dollar spent.
- If a customer spends > $50 and < $150, they are awarded 2 points for each dollar spent
- If a customer spends >= $150, they are awarded 3 points for each dollar spent. You can assume all grocery items are priced to the dollar with tax included (no cents).
Write a program that asks a customer to enter the total dollar amount spent for the trip, then displays the number of points awarded.
Define an input that accepts an age (number), check if infant, child, teenager, or adult.
Write a while loop that lets a user enter a number less than 10. If the number inputted exceeds 10, print an error and ask for the number again, in which a user may enter the same or a different number. The number should be incremented by 5, and the result assigned to a variable named sum. The loop should continue to iterate as long as the sum is less than 50. When sum exceeds 30, it should print "Almost there..." until it reaches or exceeds 50. Once it does, print out *"your final sum is {replace with final sum}". *
For example, if the sum is currently 45 and the user inputs 4, the program will not enter the loop again since the new sum will be 54 and should then print "your final sum is 45".
The flowchart shows a program's steps to troubleshooting a lamp issue. Write a program where the first prompt to the user is "What is wrong?". If the user enters "Lamp doesn't work", then the program should proceed to ask the questions depicted in the diagram and print out the responses accordingly. If any other issue is inputted initially by the user, ignore and repeat the same initial question until the correct issue is presented by the user.
Unfortunately, your landlord has announced that they will be increasing rent annually by 2% starting next year.
Write a program that takes a user's current monthly rent amount (integer) and the number of years (integer), starting the following year, the user plans to stay at the apartment, and calculates how much they will spent total in that duration of stay.
The program should print this amount back to the user.
Write a function piglatinize that accepts a sentence as an argument, uses that parameter value, and replaces words in the sentence that consist of at least 4 letters into their Pig Latin counterpart and then displays the converted sentence.
In this version, to convert a word to Pig Latin, you remove the first letter and place that letter at the end of the word.
Then, you append the string "ay" to the word.
For example:
piglatinize('I want a doggy')
// >>> I antway a oggyday
Write a program that reads the contents of a text file.
Feel free to create your own with at least three lines of words.
The program should create a dictionary in which the key-value pairs are described as follows:
- The keys are the individual words in the file.
- The values are the line numbers in the file where the word (the key) is found.
For example, suppose the word "hello" is found in lines 1, 2, 3, and 4.
The dictionary would contain an element in which the key was the string "hello" and the value was a list of the line numbers [1,2,3,4].
Once the dictionary is built, the program, in an infinite while loop, should prompt the user for a word.
When the user enters the word, the program should display what line numbers the word can be found on.
If the word is not found in the dictionary, the program should display: "{replace with user-inputted word} does not exist in the file".
