We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Day 1: Data Types
Day 1: Data Types
Sort by
recency
|
3910 Discussions
|
Please Login in order to post a comment
Em python: It took me a while to notice that what they would be using the imput() function
i = 4 d = 4.0 s = 'HackerRank '
ii = input() dd= input() ss= input()
ii = int(ii) dd=float(dd) ss=str(ss)
print(int(i)+ii) variables on a new line. print(float(d)+dd) printed first. print(str(s) + ss)
What is wrong? Mine is in C
int secondI; float secondD; char s2[100];
scanf("%d", &secondI); scanf("%1f", &secondD); scanf("%s", s2);
printf("%d\n",i + secondI);
printf("%.1f\n", d + secondD);
printf("%s%s\n", s, s2);
import java.io.; import java.util.;
public class Solution {
}
Hello,
This is the backstory. When I 'Run Code', my "Sample Test case 0" is correct. When I "Submit Code", I get the wrong answer on "Test case 1".
i = 4 d = 4.0 s = 'HackerRank '
Declare second integer, double, and String variables.
i2 = 12 d2 = 4.0 s2 = 'is the best place to learn and practice coding!'
Read and save an integer, double, and String to your variables.
i3 = i + i2 d3 = d + d2 s3 = s + s2
Print the sum of both integer variables on a new line.
print(i3)
Print the sum of the double variables on a new line.
print(d3)
Concatenate and print the String variables on a new line
print(s3)
The 's' variable above should be printed first.
This is the solutuion in Python 3.
Declare second integer, double, and String variables.
Read and save an integer, double, and String to your variables.
se_int = int(input()) se_dou = float(input()) st_va = str(input(""))
Print the sum of both integer variables on a new line.
print(se_int+i)
Print the sum of the double variables on a new line.
print(se_dou + d)
Concatenate and print the String variables on a new line
print(s + st_va)
The 's' variable above should be printed first.