Physical Address

304 North Cardinal St.
Dorchester Center, MA 02124

Input() Hacker Rank Solution – Queslers

Problem : Input() Hacker Rank Solution

This challenge is only forPython 2.input()in Python 2, the expression input() is equivalent to eval(raw _input(prompt)).
code :

>>> input()  
1+2
3
>>> company = 'HackerRank'
>>> website = 'www.hackerrank.com'
>>> input()
'The company name: '+company+' and website: '+website
'The company name: HackerRank and website: www.hackerrank.com'

Task :

You are given a polynomial P of a single indeterminate (or variable), x.
You are also given the values of x and k. Your task is to verify if P(x) == k.


Constraints :

All coefficients of polynomial P are integers.
x and y are also integers.

Input Format :

The first line contains the space separated values of x and k.
The second line contains the polynomial P.

Output Format :

Print True if P(x)==k. Otherwise, print False.


Sample Input :

1 4
x**3 + x**2 + x + 1

Sample Output :

True

Explanation :

P(1) = 1^3 + 1^2 + 1 + 1 = 4 = k
Hence, the output is True.

Input() Hacker Rank Solution in python 2

# Enter your code here. Read input from STDIN. Print output to STDOUT

x,k = map(int,raw_input().split())
print k==input()

Input() Hacker Rank Solution in python 3

# Enter your code here. Read input from STDIN. Print output to STDOUT
ui = input().split()
x = int(ui[0])
print(eval(input()) == int(ui[1]))

Input() Hacker Rank Solution in pypy

x,k=map(int,raw_input().strip().split(" "))
p=eval(raw_input())
if(p==k):
    print True
else:
    print False

Input() Hacker Rank Solution in pypy 3

s = input() # read input
# s = "1 4";
f = input()
# f = "x^3 + x^2 + x + 1"
(x,y) = s.split() # args
x=int(x)
y=int(y)
# print (x, y)
z=eval(f)
if (z == y):
    print ("True")
else:
    print ("False")
Input() Hacker Rank Solution Review:

In our experience, we suggest you solve this Input() Hacker Rank Solution and gain some new skills from Professionals completely free and we assure you will be worth it.

Input() is available on Hacker Rank for Free, if you are stuck anywhere between compilation, just visit Queslers to get all Hacker Rank Solution

Input() Hacker Rank Solution Conclusion:

I hope this Input() Hacker Rank Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Hacker Rank, Leetcode, Codechef, Codeforce Solution.

This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.

Keep Learning!

More Hacker Rank Problem & Solutions >>

Mini-Max Sum Hacker Rank Solution

String Validators Hacker Rank Solution

Text Alignment Hacker Rank solution

String validators Hacker Rank Solution

Staircase Hacker Rank Solution

Leave a Reply

Your email address will not be published. Required fields are marked *