given a square matrix print the sum all diagonal elements of the matrix
sample input :
3
1 2 3
4 5 6
7 8 9
sample output:
25
given a list of numbers find and print the first number that occurs only once in the list and the first number that occurs more than once in the list
sample input 1:
5 5 4 7 4 1 11
sample output 1:
7
5
sample input 2:
1 2 3 4 5 6 7 8 9
sample output 2:
1
None
by Rhea Tortor
You task is to write a program that will continuously add friend data to a list named friends until the user enters "No". The program must display the contents of friend list.
friend's data to be collected:
Last name
First name
Birthdate
Gender
Contact No.
Validation:
Name must not be empty.
Must check the validity of the birth date.
Gender either F or M only.
Contact No. must be exactly 11 digits.
Display "Invalid input!" and ask the user to input another value.
Input
Friend's data
Tortor
Rhea
12/25/1990
F
09172345678
No
Output
Name:·Rhea·Tortor
Birthdate:·December·25,·1990
Gender:·Female
Contact·No.:·09172345678
by Rhea Tortor
You task is to write a program that will continuously add friend data to a list named friends until the user enters "No". The program must display the contents of friend list.
friend's data to be collected:
Last name
First name
Birthdate
Gender
Contact No.
Validation:
Name must not be empty.
Must check the validity of the birth date.
Gender either F or M only.
Contact No. must be exactly 11 digits.
Display "Invalid input!" and ask the user to input another value.
Input
Friend's data
Tortor
Rhea
12/25/1990
F
09172345678
No
Output
Name:·Rhea·Tortor
Birthdate:·December·25,·1990
Gender:·Female
Contact·No.:·09172345678
For example, if the given numbers are 5, 3, 7, 2. As 7 is the greatest among the four numbers, so the output should be 7.
Maximum
You are given
N number of inputs. Print the maximum of them after each input.Input
The first line of input is an integer
N. The next N lines each contain an integer as input.Explanation
In the example, you are given
6 inputs 1, 0, 3, 2, 9, 8.
1 is maximum in the input 1.
1 is maximum in the input 1, 0.
3 is maximum in the input 1, 0, 3.
3 is maximum in the input 1, 0, 3, 2.
9 is maximum in the input 1, 0, 3, 2, 9.
9 is maximum in the input 1, 0, 3, 2, 9, 8.
So, the output should be
1
3
3
9
9
input
4
10
9
8
7
output should be
10
9
9
9
1. Create a class Restaurant, the __init__ (self, Name, Country, City, BranchNumber, CuisineType) method for restaurant should store restaurant name, country, city, its branch number and cuisine type.
2. Create a method DescRestaurant that prints the name, Country, City, BranchNumber and Cuisine type of the restaurant.
3. Create a method RestaurantTiming, the method should print out the opening and closing time of the restaurant.
4. Create two instances of the class Restaurant with two different Names, Country, City, BranchNumber and CuisineType then call the DescRestaurant and RestaurantTiming method for each instance.
program to check wether character is uppercase or lowercase alphabet
jeff ordered several items from an online shop. After recieving the order he found that some were faulty. So he wants to seperatethe faulty items from the rest. You are given that prices of the item Jeff ordered, where a negative sign indicates a faulty item. Write a program to shift prices of all the faulty items to the left without changing the relatie order of the input.
SAMPLE INPUT 1:
11 -12 13 -14 15 16
SAMPLE OUTPUT 1:
-12 -14 11 13 15 16
SAMPLE INPUT 2:
21 11 -3 -2 9
SAMPLE OUTPUT 2:
-3 -2 21 11 9
Your task is to write a program that will continuously add friend data to a list named friends until the user enters "No". The program must display the contents of friend list.
friend's data to be collected:
Last name
First name
Birthdate
Gender
Contact No.
Validation:
Name must not be empty.
Must check the validity of the birth date.
Gender either F or M only.
Contact No. must be exactly 11 digits.
Display "Invalid input!" and ask the user to input another value.
Input
Friend's data
Tortor
Rhea
12/25/1990
F
09172345678
No
Output
Name:·Rhea·Tortor
Birthdate:·December·25,·1990
Gender:·Female
Contact·No.:·09172345678