Beginners Coding Challenge
I'm trying the challenges using Python.
Whenever I need to input a value from the user, my code works perfectly when I run it, however, it fails the test cases.
For example:
Scan name of user and say Hello
Write a program to scan the name of the user and say hello to them.
Example input:
Peter
Example output:
Hello Peter
STDIN: Peter
Code:
print("Hello {0}".format(input()))
Output:
Hello Peter
1/2 test cases passed
Same for:
Read two numbers as input and print the sum of the two given numbers. Sample input and output are shown as below
Input
3
4
Output
7
STDIN:
3
4
Code:
num1 = input()
num2 = input()
print(int(num1) + int(num2))
Output:
7
0/2 test cases passed
Anyone knows why? Thanks!
Update:
It is now working as intended. Thank you!
3 Answers
@Badieh can you replicate your code as a new code and share that link? so that we can see if you are making a mistake.
Currently we can't see which language you are using what's the exact code etc
Update:
We have fixed a bug related to Python, you should not see any more wrong behaviour with testcases
Sorry, new to the website. Trying to figure out how to do it.
I believe you can find it here:
https://onecompiler.com/python/3xsrpfxcn
Thanks!
Solution for Scan Name and say Hello in PYTHON:
name=input()
print("Hello "+name)
Solution for Sum of Integers in PYTHON:
num1=int(input())
num2=int(input())
sum=num1+num2
print(sum)