Write a program that reads an integer and prints how many digits the number has, by
checking whether the number is ≥ 10, ≥ 100, and so on. (Assume that all integers are
less than ten billion.) If the number is negative, first multiply it with –1. Sample runs of the program are given below:
Enter an integer less than 10 billion: 576838
Digits: 6
Enter an integer less than 10 billion: 100000000000
Number is out of range
Enter an integer less than 10 billion: 7645362758
Digits: 10
Date Format - 2
Given seconds as input, write a program to print in D days H hours M minutes S seconds.Input
The input will be a single line containing an integer.Output
The output should be a single line containing the D Days H Hours M Minutes S Seconds format. Print only the non-zero values.Explanation
For example, if the given seconds are 200. As 200 seconds is equal to 3 minutes and 20 seconds, and days, hours are zero, so ignore the days and hours. So the output should be "3 Minutes 20 Seconds"
Sample Input 1
200
Sample Output 1
3 Minutes 20 Seconds
Sample Input 2
86400
Sample Output 2
1 Days
Right Angle Triangle
Given an integer N, write a program to print a right angle triangle pattern similar to the pattern shown below
/|
/ |
/ |
/ |
/____|Input
The input will be a single line containing a positive integer (N).Output
The output should be N lines containing the triangle pattern.Explanation
For example, if the given number is 5, the pattern should be printed in 5 lines, as shown below
/|
/ |
/ |
/ |
/____|Sample Input 1
5
Sample Output 1
/|
/ |
/ |
/ |
/____|
Sample Input 2
4
Sample Output 2
/|
/ |
/ |
/___|
Date Format - 2
Given seconds as input, write a program to print in D days H hours M minutes S seconds.Input
The input will be a single line containing an integer.Output
The output should be a single line containing the D Days H Hours M Minutes S Seconds format. Print only the non-zero values.Explanation
For example, if the given seconds are 200. As 200 seconds is equal to 3 minutes and 20 seconds, and days, hours are zero, so ignore the days and hours. So the output should be "3 Minutes 20 Seconds"
Sample Input 1
200
Sample Output 1
3 Minutes 20 Seconds
Sample Input 2
86400
Sample Output 2
1 Days
Date Format - 2
Given seconds as input, write a program to print in D days H hours M minutes S seconds.
Input
The input will be a single line containing an integer.
Output
The output should be a single line containing the D Days H Hours M Minutes S Seconds format. Print only the non-zero values.
Explanation
For example, if the given seconds are 200. As 200 seconds is equal to 3 minutes and 20 seconds, and days, hours are zero, so ignore the days and hours. So the output should be "3 Minutes 20 Seconds"
Sample Input 1
200
Sample Output 1
3 Minutes 20 Seconds
Sample Input 2
86400
Sample Output 2
1 Days Right Angle Triangle
Given an integer N, write a program to print a right angle triangle pattern similar to the pattern shown below
/|
/ |
/ |
/ |
/____|
Input
The input will be a single line containing a positive integer (N).
Output
The output should be N lines containing the triangle pattern.
Explanation
For example, if the given number is 5, the pattern should be printed in 5 lines, as shown below
/|
/ |
/ |
/ |
/____|
Sample Input 1
5
Sample Output 1
/|
/ |
/ |
/ |
/____|
Sample Input 2
4
Sample Output 2
/|
/ |
/ |
/___|You are going to create a quiz in python. Your program should allow the player to choose the subject they want to attend the quiz. For each subject, you are required to display at least 3 questions for them to answer. After each question, they answered you need to display the result whether the answer they chose is correct or wrong. After they finished answering all the questions, your program should display the score they have earned in that subject quiz. Note: You are required to implement the concepts (decision structure, repetitive structure, function) that we have studied in programming concept class. Take note that you have to give at least 3 subjects as options and provide at least 3 questions for each subject.
Write a function that finds the factorial of a number. The function should get a number from the user as an argument and should print the factorial of the number as the user requested.
Write a function named max that accepts two integer values as arguments and returns the value that is the greater of the two. For example, if 7 and 12 are passed as arguments to the function, the function should return 12. Use the function in a program that prompts the user to enter two integer values. The program should display the value that is the greater of the two.
Write a function that calculates a taxi fare for the travelers. Your program should get the information of the distance traveled by the customer and calculate the taxi fare and should display it to the passenger for the payment to be received. The taxi fare consists of a base fare of RM 4.00 plus charges of RM 0.25 for every 140 meters traveled. Define and call the function accordingly.