Python Basic

 1.1

MAHIRL'S EVENING PARTY

Mahirl's Evening Party

 

Mahirl has started an Event Management Company named “Amphi Events and Decors”. The focus of this venture is to provide event management solutions for both personal functions and private parties, Organize and manage corporate events that leave a lasting impression and project your perfection.

 

In order to get herself equipped with the event management skills, she is organizing an Evening Party everyday in the first month.
She booked a popular hall named “Amphi Mahal” that could accommodate around 1000 people.
                                                             
She expected more crowd to this party during week ends and so she conducted the week end parties in the Codissia Open Ground.

                                                        

After a month, she has to submit a report to the Board of Directors on how succesful these parties were.
                                                       
A week day party is considered to be succesful if the number of people attending this party is between 700 and 1000, both inclusive. [ The hall is neither undercrowded or overcrowded].
A weekend party is considered to be successful if the number of people attending the party is at least 1500.

 

Can you please help Mahirl in classifying whether the given parties were successful or not?

           

Given the day details and the number of people who have attended the party on that day, write a program to classify the party as successful or not.

 

Input Format:

 

The first line of the input consists of a string that corresponds to the day details. The 7 days are denoted as “SUN”, “MON”, “TUE”, “WED”, “THU”, “FRI” and “SAT”.

Friday, Saturday and Sunday are considered to be week ends.

 

The second line of the input consists of an integer that corresponds to the number of people who have attended the party.

 

Output Format:

 

Output consists of a string --- “Successful” or “Unsuccessful” or “Invalid Input”.

 

If the input string is not in one of the valid days or the if the input integer is negative, print Invalid Input.
Refer sample input and output for formatting specifications.

 

 

Sample Input 1:

MON

800

 

Sample Output 1:

Successful

 

Sample Input 2:

FRI

1200

 

Sample Output 2:

Unsuccessful

 

Sample Input 3:

MAN

800

 

Sample Output 3:

Invalid Input





1.2

VANYA AND BOOKS

Vanya and Books
Vanya got an important task — he should enumerate books in the library and label each book with its number. Each of the n books should be assigned with a number from 1 to n. Naturally, distinct books should be assigned distinct numbers.

Vanya wants to know how many digits he will have to write down as he labels the books.
For example,
If n = 13, the books get numbers 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, which totals to 17 digits.
 
Input Format:
The first line contains integer n, which corresponds to the number of books in the library.
 
Output Format:
Print the number of digits needed to number all the books.
Refer sample input and output for formatting specificaions.

Sample Input 1:
13
Sample Output1:
17
 
Sample Input 2:
4
Sample Output2:
4








1.3

S3P8 - LUCKY CARDS

Lucky Cards
 
The Hatfield Game Fair is the premier event of its kind for adults interested in some intellectual and cognitive brain games. Exciting games were organized for kids between age group of 8 and 10. One such game was the "Lucky Cards", a simple two-player game, played with a deck of cards. The cards in the deck have these possible names: two, three, four, five, six, seven, eight, nine, ten, jack, queen, king, ace. The cards labeled jack, queen, king, ace are collectively known as high cards.
The numerical equivalent of the high cards is as given below:
Jack – 11
Queen – 12
King – 13
Ace - 1
Please note here, though Ace has a numerical equivalent value as 1, it is always considered as the top rated card. So it is also included in the list of high cards.
 
The game organizer selects N cards and places it in the deck faced-down on the table. Player A turns over the top card and places it on a pile; then player B turns over the top card and places it on the same pile. A and B alternate turns until the N cards are exhausted. The game is scored as follows:
  • if a player turns over an ace that is 1, with at least 4 cards remain to be turned over, and none of the next 4 cards is a high card, that player scores 4 points
  • if a player turns over a king that is 13, with at least 3 cards remain to be turned over, and none of the next 3 cards is a high card, that player scores 3 points
  • if a player turns over a queen that is 12, with at least 2 cards remain to be turned over, and none of the next 2 cards is a high card, that player scores 2 points
  • if a player turns over a jack that is 11, with at least 1 card remains to be turned over, and the next card is not a high card, that player scores 1 point
Write a program to calculate the scores of the two players.
 
Input Format:
The first line of the input contain an integer N, which corresponds to the number of cards in the deck.
Each of the following N lines will contain an integer that corresponds to the numerical value of the cards that the players turn over. The first line denotes the first card to be turned over; the next line the next card; and so on.

Output Format:
Print the individual scores of the players whenever a player scores in separate new lines.
Print the total score for each player in the last two lines of the output at the end of the game.
Refer sample input and output for formatting specifications.
 
Sample Input 1:
15
3
2
1
5
6
4
8
11
2
3
2
13
6
10
6

Sample Output 1:
Player A scores 4 point(s)
Player B scores 1 point(s)
Player B scores 3 point(s)
Player A: 4 point(s)
Player B: 4 point(s)

Sample Input 2:
15
3
2
1
5
6
12
8
11
12
3
1
13
6
11
6

Sample Output 2:
Player B scores 1 point(s)
Player A: 0 point(s)
Player B: 1 point(s)


Comments

Popular posts from this blog

2-D Arrays

String

Conditional Statements