Develop a program to read the name, birthday and gender of a person from a file and output the name and ten-digit national identity card (NIC) number to another file where each name is starting on a new line (see the example below). The only input to the program is the name of the file. The output of the programme is the file "output.txt". Below are the rules for forming the NIC number.
Create a product class with product name, stock balance and price as attributes. include a constructer method (_init_) and also include methods for show data, issue product and get discount. Issue product must update stock balance by reducing it by a given quantity. Get discount must calculate and return 10% of price as discount. In the main program create two product objects and pass messages.
Profit or Loss
The amount at which a product is sold by the seller is known as the Selling Price. The amount at which the seller has acquired the product is known as the Cost Price.
If the Selling Price of a product is higher than its cost price, then the seller has made a profit. If it is lesser, then the seller has incurred loss selling that product. If the Selling Price is equal to the Cost Price, it means the seller has made No Profit and No loss, by selling the product.
Given Cost price
The first line is an integer
In the given example,
CP = 143,SP = 155, So as the selling price is higher than the cost price, the output should be Profit.
Sample Input 1
143
155
Sample Output 1
Profit
Sample Input 2
165
125
Sample Output 2
Loss
3-digit Armstrong Number
Write a program to check if a given 3-digit number X is an Armstrong number or not.
Note: A number is an Armstrong number if the number is equal to the sum of the Nth power of its digits.
Input
The first line is an integer X.
Output
The output should be a single line containing True if it satisfies the given conditions, False in all other cases.
Explanation
In the given example X = 371,
The number of digits in 371 is 3.
So, 33 + 73 + 13 = 371. Hence, 371 is an Armstrong number.
So, the output should be True.
Sample Input 1
371
Sample Output 1
True
Sample Input 2
351
Sample Output 2
False
Write a program that prompts the user to input two POSITIVE numbers — a dividend (numerator) and a divisor (denominator). Your program should then divide the numerator by the denominator, and display the quotient followed by the remainder.
Hint: If you use division (/) to calculate the quotient, you will need to use int() to remove the decimals. You can also use integer division (// ), which was introduced in Question 10 of Lesson Practice 2.3.
Once you've calculated the quotient, you will need to use modular division (%) to calculate the remainder. Remember to clearly define the data types for all inputs in your code. You may need to use float( ) , int( ), and str( ) in your solution.
.
Write an algorithm to find the ERG character for a given employee's ERP