For Apple store services and apps(like games, videos, etc ): you can gain access if you are15years old or less and your parent has an Apple ID. If you are 16 years old or more you need to have your own Apple ID.
Write a program that uses short circuit logic to tell someone if they are legal to gain access to Apple store services. First ask them how old they are, whether they have an Apple ID or not, and whether their parent has an Apple ID or not.
The sum of the first n positive integers can be computed by the formula
sum(1..n) = 1 + 2 + 3 + 4 + · · · + n = n(n + 1)/2
Write a short Python program that computes the sum of the first 100 positive integers and prints it to the screen, using format specifiers when printing instead of converting each item to a string. Use variables to represent the 1, the 100, and the result of the computation. Your program must compute the 5050 value. You cannot just print the result to the screen. You must compute it first from the 100. The goal is for the output to look exactly the same.The output is as shown below:
sum(1..100) = 5050
Eligibility Criteria - 4
Given a student has scored M marks in Maths, P marks in Physics and C
marks in Chemistry. Write a program to check if a student is eligible for admission in a professional course. If any one of the below conditions is satisfied then the student is eligible.
1) M >= 60, P >= 50, C >= 45 and M + P + C >= 180.
2) Total in M and P >= 120 or Total in C and P >= 110.
The first line is an integer M
The second line is an integer p
The third line is an integer C
The output should be a single line containing True , if it satisfies the given conditions, False in all other cases
Given M = 72, P = 65, C = 51 , the scores of this student satisfies the first condition
M >= 60, (72 >= 60)
P >= 50 (65 >= 50)
C >= 45 (51 >= 45)
M + P + C >= 180 (72 + 65 + 51 >= 180)
So, the student is eligible.
Sample Input 1
72
65
51
Sample Output 1
True
Sample Input 2
70
70
Sample Output 2
False
Sample Input 3
60
60
40
Sample Output 3
True
Years, Weeks & Days
Given N number of days as input, write a program to convert N. number of days to years (Y)
weeks (W) and days (D)
Note:
The input contains single integer N
Print space-separated integers Y, W and D
Given N = 1329
The value can be written as
1329 = 3 years + 33 weeks + 3 days
So the output should be
3 33 3
.
Sample Input 1
1329
Sample Output 1
3
33
3
Sample Input 2
Sample Output 2
Elements in the Range
You are given three numbers. Check if any of the numbers exist in the range from 10 to 20 (including 10 and 20).
The first, second, and third lines of input are integers.
The output should be either
True or False
Given
a = 2, b = 4, c = 16 , 16 is in the range between 10 and 20.
So the output should be True
Sample Input 1
2
4
16
Sample Output 1
True
Sample Input 2
2
4
6
Sample Output 2
False
You are given N number of inputs. Print the maximum of them after each input.
Diamond Crystal
Given an integer value
N, write a program to print a diamond pattern of 2*N rows as shown below.
You are given a word W as input. Print W by adding a hyphen (-) between each letter in the word.
In the given example, the word is
Hello.So, the output should be H-e-l-l-o.
Zig-Zag Order in Matrix
you are given a matrix of dimensions M * N . print the numbers of the matrix in the zig-zag order.
Zig-Zag order of the matrix.
start from the first element in the first row of the matrix and print all the numbers in the first row.
after reaching the end of the first row , move to the last element in the next row and start printing the numbers from the right side of the second line until you reach the first element in the second line .
Now jump to the first element in the third row and repeat the above process.
Sample input:
4 4
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
SAMPLE OUTPUT :
1 2 3 4 8 7 6 5 9 10 11 12 16 15 14 13
SAMPLE INPUT:
3 4
1 2 3 4
10 11 12 5
9 8 7 6
SAMPLE OUTPUT :
1 2 3 4 5 12 11 10 9 8 7 6