• Welcome to Programming_info!!

    Here you will get questions as well as there solutions.
    we provid you daily with a new question and it's solution.
    we have codechef and hackerrank solution for beginner now.

  • Welcome to Programming_info!!

    Here you will get questions as well as there solutions.
    we provid you daily with a new question and it's solution.
    we have codechef and hackerrank solution for beginner now.

  • Welcome to Programming_info!!

    Here you will get questions as well as there solutions.
    we provid you daily with a new question and it's solution.
    we have codechef and hackerrank solution for beginner now.

  • Welcome to Programming_info!!

    Here you will get questions as well as there solutions.
    we provid you daily with a new question and it's solution.
    we have codechef and hackerrank solution for beginner now.

  • Welcome to Programming_info!!

    Here you will get questions as well as there solutions.
    we provid you daily with a new question and it's solution.
    we have codechef and hackerrank solution for beginner now.

Hanging Bridge |Programming_info || python_problem_11

 At the annual "KrackerJack Karnival", there was a newest attraction ever in the City, the "Hanging Bridge". Visitors will be able to walk 200ft on the bridge, hanging around 50ft above the ground, and enjoy a wide-angle view of the breathtaking greenery.

The Hanging Bridge was inaugurated successfully in co-ordination with the Event Manager Rahul. There is a limit on the maximum number of people on the bridge and Rahul has to now ensure the count of people on the bridge currently should not exceed the limit. He then approximately estimated that adults and kids who came to the show, were on the hanging bridge. He also noticed that there are L legs of the people touching the bridge.
Rahul knows that kids love to ride on the adults and they might ride on the adults, and their legs won't touch the ground and hence he would miss counting their legs. Also Rahul knew that the adults would be strong enough to ride at max two kids on their back.
Rahul is now wondering whether he counted the legs properly or not. Specifically, he is wondering is there some possibility of his counting being correct. Please help Rahul in finding it.

 
Input Format:
The only line of input contains three space separated integers C, D, L denoting number of the adults, number of the kids and number of legs of people counted by Rahul, respectively.

Output Format:
Output a single line containing a string "yes" or "no" (both without quotes) according to the situation.
Refer sample input and output for formatting specifications.

Sample Input 1:
1 1 4

Sample Output 1:
yes

Sample Input 2:
2 4 16

Sample Output 2:
no

Solution:
a,b,c=[int(i) for i in input().split()]
if((a+b)*2>=c):
    print("yes")
else:
    print("no")

Share:

Aayush's Scholarship |Programming_info || python_problem_10


Aayush studies in Teswan National University. Now is the time for exam results. Aayush similar to other students, hopes that his scores in 5 subjects in the exam could fetch him a scholarship for his GRE preparation.
 
The following simple rules  are used to find whether he is eligible to receive scholarship:
  • University follows 5 point grading system. In an exam, a student can receive any score from 2 to 5.  2 is called an F grade, meaning that student has failed that exam.
  • Student should not have fail any of the exams.
  • Student must obtain a full score in some of his/her exams to show that he/she is excellent in some of the subjects.
  • He/She must have a grade point average not less than 4.0
​You are given information regarding how Aayush performed in those 5 subjects . Help him determine whether he will receive the scholarship or not.
 
Input Format:
The input contains 5 space separated integers denoting Aayush’s 5 subjects score in the exam.
 
Output Format:
Output a single line - "Yes" (without quotes) if Aayush will receive scholarship, or "No" (without quotes) otherwise.
Refer sample input and output for formatting specifications.

Sample Input 1:
3 5 4 4 3

Sample Output 1:
No

Sample Input 2:
3 4 4 4 5

Sample Output 2:
Yes

Solution:

a,b,c,d,e =[int(i) for i in input().split()]

if a==2 or b==2 or c==2 or d==2 or e==2:

    print("no")

elif ((a+b+c+d+e)/5>=4.0):

    print("Yes")

else:

    print("No")

Share:

Daily Routine |Programming_info || python_problem_09

 Brendon is a little techno-whiz whose IQ is out of the charts. He has set up a laboratory at home for his research and development and was once approached by an Event Management firm to design them a Robot that would log all the activities carried out in an event at various instants during the day. This would help them keep a track and in smooth functioning of events.

Brendon, after long days of hard work designed one such Robot but wanted to test it on his own daily routines. His daily routine is very simple, he starts his day working in a computer, then he eats food and finally proceeds for sleeping thus ending his day. He has programmed his Robot to log the activities of him at various instants during the day.
Today it recorded activities that Brendon was doing at N different instants. These instances are recorded in chronological order (in increasing order of time). This log is provided to you in form of a string s of length N, consisting of characters 'C', 'E' and 'S'. If s[i] = 'C', then it means that at the i-th instant Brendon was working in Computer, 'E' denoting he was eating and 'S' means he was sleeping.
Write a program to tell whether the record log made by the robot could possibly be correct or not.

Input Format:
The only line of input contains the string s.

Output Format:
Output a single line containing "yes" or "no" (without quotes) accordingly.
Refer sample input and output for formatting specifications.

Sample Input 1:
CES

Sample Output 1:
yes

Sample Input 2:
SCCC

Sample Output 2:
no

Solution:
x=input()
a=0
for i in range(len(x)-1):
    if x[i]=='C':
        if x[i+1]=='C' or x[i+1]=='S' or x[i+1]=='E':
            a+=1
    elif x[i]=='E':
        if x[i+1]=='E' or x[i+1]=='S':
            a+=1
    elif x[i]=='S':
        if x[i+1]=='S':
            a+=1

if(a==len(x)-1):
    print("yes")
else:
    print("no")
Share:

Welcome |Programming_info || python_problem_08

 A recently launched attraction at the "Events Square" entertainment fair is the "Carnival of Terror" which is an interactive fun zone featuring scary, horror and Halloween stories.

 
The Entry tickets for the show is to be printed with a Welcome message along with an additional message for Children stating they should be accompanied by an adult. Given the age of the person visiting the scary house, the ticket should carry the additional message only for Children whose age is less than 15 years. The show organizers wanted your help to accomplish this task. Write a program that will get age as the input and display the appropriate message on the tickets.

 
Input Format:
First line of the input is an integer that corresponds to the age of the person.

Output Format:
Output should display the additional message "Please note that you should be accompanied by an adult" for Children less than 15 years. Otherwise it should print only the Welcome message.
Refer sample input and output for formatting specifications.

Sample Input 1:
20

Sample Output 1:
Welcome to the show

Sample Input 2:
14

Sample Output 2:
Welcome to the show
Please note that you should be accompanied by an adult

 

Solution:

x=int(input())

if(x>=15):

    print("Welcome to the show")

else:

    print("Welcome to the show")

    print("Please note that you should be accompanied by an adult")

Share:

Talent Show |Programming_info || python_problem_07

 Mountain View Middle School is all set for organizing their elaborate talent show event of the year, "Stars Onstage". It is a fun-filled event for the students to showcase and build their confidence.

Of the total audience who had come for the show, 1/3 were boys, 3/6 were girls and the rest of them were adults. If there were 'x' more girls than adults, how many people were there in total? Help the School authorities to find the total people who visited their show.
 
Input Format:
First line of the input is an integer 'x', which corresponds to the count of girls more than adults.
 
Output Format:
Output the total number of people who had visited the talent show.
Refer sample input and output for formatting specifications.
[All text in bold corresponds to input and rest corresponds to output.]

Sample Input and Output1:
Enter x
50
150 people were there in total

Sample Input and Output2:
Enter x
70
210 people were there in total

Solution:
print("Enter x")
x=int(input())
y=1/3*x+3/6*x
a=1-y
tot=x*3
print(tot," people were there in total")

Share:

Tile Game |Programming_info || python_problem_06

 In connection to the National Mathematics Day celebration, the Regional Mathematical Scholars Society had arranged for a Mathematics Challenge Event where school kids participated in large number. Many interesting math games were conducted, one such game that attracted most kids was the tile game where the kids were given 'n' square tiles of the same size and were asked to form the largest possible square using those tiles.

 
Help the kids by writing a program to find the area of the largest possible square that can be formed, given the side of a square tile (in cms) and the number of square tiles available.
 
Input Format:
First line of the input is an integer that corresponds to the side of a square tile (in cms).
Second line of the input is an integer that corresponds to the number of square tiles available.
 
Output Format:
Output should display the area of the largest possible square that can be formed (in square cms) with the available tiles.
Refer sample input and output for formatting specifications.
[All text in bold corresponds to input and rest corresponds to output.]

Sample Input and Output :
Enter the side in cm of a square tile
5
Enter the number of square tiles available
8
Area of the largest possible square is 100sqcm

Solution:
import math
print("Enter the side in cm of a square tile")
x=int(input())
print("Enter the number of square tiles available")
y=int(input())
area=x*int(math.sqrt(y))
area1=area**2
print("Area of the largest possible square is",area1," sqcm")

Share:

Welcome Message |Programming_info || python_problem_05

 "Pine Tree" is a recently launched startup Event Management company. The company gained a good reputation within a short span because of its highly reliable service delivery.

 
Nikhil, the founder of this company wished to take the company’s services to the next step and decided to design an Event Management System that would let its Customers plan and host events seamlessly via an online platform. As a part of this requirement, Nikhil wanted to write a piece of code for his company’s Amphi Event Management System that will welcome all the Customers who are using it. Help Nikhil on the task.


Output Format:
Output should display "Welcome to Amphi Event Management System".
Refer sample output for formatting specifications.


Sample Output:
Welcome to Amphi Event Management System

Solution:

 print("Welcome to Amphi Event Management System")

Share:

Tic-Tac-Toe | programming_info || Python_problem-04

 Rules for the game:

1.Display game board with 9 position for x and o

2.Make sure the board is empty and the first player to start

3.Numbered cells for each player turn

4.provide error message for placing a number in filled cell

5. If a player scores a line of 3 symbols provide "You Won" message

Code using python:

theBoard = {'7': ' ', '8': ' ', '9': ' ',

            '4': ' ', '5': ' ', '6': ' ',

            '1': ' ', '2': ' ', '3': ' '}

boardKeys = []


# print(boardkeys)

for key in theBoard:

    boardKeys.append(key)


# print(boardkeys)

def printBoard(board):

    print(board['7'] + '/' + board['8'] + '/' + board['9'])

    print('-/-/-')

    print(board['4'] + '/' + board['5'] + '/' + board['6'])

    print('-/-/-')

    print(board['1'] + '/' + board['2'] + '/' + board['3'])

    print('-/-/-')


# printBoard(theBoard)

def game():

    turn = 'X'

    count = 0

    for i in range(10):

        printBoard(theBoard)

        print(" It is turn of" + "turn" + "Specify the place you want to go ")

        move = input()

        if theBoard[move] == ' ':

            theBoard[move] = turn

            count += 1

        else:

            print("Sorry this cell location is filled.Please choose another one")

            continue

        if count >=5:

            if theBoard['7'] == theBoard['8'] == theBoard['9'] != ' ':

                printBoard(theBoard)

                print("Player " + "won the game")

                break

            if theBoard['4'] == theBoard['5'] == theBoard['6'] != ' ':

                printBoard(theBoard)

                print("Player " + "won the game")

                break

            if theBoard['1'] == theBoard['2'] == theBoard['3'] != ' ':

                printBoard(theBoard)

                print("Player " + "won the game")

                break

            if theBoard['1'] == theBoard['4'] == theBoard['7'] != ' ':

                printBoard(theBoard)

                print("Player " + "won the game")

                break

            if theBoard['2'] == theBoard['5'] == theBoard['8'] != ' ':

                printBoard(theBoard)

                print("Player " + "won the game")

                break

            if theBoard['3'] == theBoard['6'] == theBoard['9'] != ' ':

                printBoard(theBoard)

                print("Player " + "won the game")

                break

            if theBoard['1'] == theBoard['5'] == theBoard['9'] != ' ':

                printBoard(theBoard)

                print("Player " + "won the game")

                break

            if theBoard['3'] == theBoard['5'] == theBoard['7'] != ' ':

                printBoard(theBoard)

                print("Player " + "won the game")

                break

        if count ==9:

            print("\n Game over")

            print("The game is tie!")

        if turn == 'X':

            turn = '0'

        else:

            turn = 'X'

    restart = input("Do u want to restart the game? (y/n)")

    if restart == 'y' or restart =='Y':

        for key in boardKeys:

            theBoard[key] = ' '

        game()

if _name_ =="_main_":

    game()

Share:

Guess_The _Number | Programming_info || python_series_03

 Rules For the game:

1. change the number range from 1 to 1000000

2. Game should ask us to change a number

3.Give a clue of the number is higher or lower than the guess

 4. inform the player if he won 

Code using Python:

from random import randint

start = 1

end = 500

value = randint(start, end)

print("The computer choose the number between ", start, "and", end)

guess = None

while guess != value:

    text = input("Guess the number : ")

    guess = int(text)


    if guess < value:

        print("The number is higher")

    elif guess > value:

        print("The number is lower")


print("Congratulations !!! you guessed the number ! You won")


Output:

The computer choose the number between  1 and 500

Guess the number : 250

The number is higher

Guess the number : 375

The number is higher

Guess the number : 450

The number is lower

Guess the number : 400

The number is higher

Guess the number : 425

The number is lower

Guess the number : 410

The number is lower

Guess the number : 405

The number is lower

Guess the number : 402

The number is higher

Guess the number : 404

The number is lower

Congratulations !!! you guessed the number ! You won


Share:

Python If-Else | Hackerrank | Programming_info || Python_Problem_02

 Task

Given an integer, , perform the following conditional actions:

  • If  is odd, print Weird
  • If  is even and in the inclusive range of  to , print Not Weird
  • If  is even and in the inclusive range of  to , print Weird
  • If  is even and greater than , print Not Weird

Input Format

A single line containing a positive integer, .

Constraints

Output Format

Print Weird if the number is weird. Otherwise, print Not Weird.

Sample Input 0

3

Sample Output 0

Weird

Explanation 0


 is odd and odd numbers are weird, so print Weird.

Sample Input 1

24

Sample Output 1

Not Weird

Explanation 1


 and  is even, so it is not weird.

Code using Python

n=int(input())

if n%2==0 and (n in range(2,6) or n>20):

     print("Not Weird")

else :

    print("Weird")

        

Share:

Translate

Recommended platforms

  1. codechef
  2. hackerrank
  3. codeforces
  4. leetcode
  5. hackerearth

Popular Posts

programming_info. Powered by Blogger.

Recent Posts

other platforms

  • geeks for geeks
  • w3schools
  • codepen
  • skillshare
  • udemy

Pages

reader support Support