0
Can u me to fix this code?
x <- readline(prompt='Enter the number:') #your code goes here litre<- x*3.875 litre<-as.integer(litre) print(litre)
23 Answers
+ 2
Alexander Shensnevich print should be in small letter .
Hello world should be inside the
✖️semicolons
✔️ single or double quotes
+ 5
AML Yakin
Yes but don't learn multiple languages together because every languages syntax are different so you may get confuse like here you have written prompt inside readLine function. And also read lessons properly because in previous lesson given how to take input and what is the syntax.
+ 2
AML Yakin
You don't need to convert litre in integer. Practice description didn't say anything. Check my previous answer again.
+ 2
Try this
#Can u me to fix this code?
x <- readLines('stdin')
#your code goes here
x<-as.integer(x)
sum<-x*3.20
sum<- as.integer(sum)
print(litre)
+ 2
AML Yakin
Here is right solution:
x <- readLines('stdin')
litre <- as.integer(x)
print(litre * 3.785)
+ 1
AML Yakin
Syntax of reading input is wrong. Did you see lesson properly?
Here is proper syntax.
x = readLines('stdin')
you have to convert x to integer not litre to integer. Litre will be integer after multiply with x
+ 1
SoloProg
Why x <- 2.5?
+ 1
Thx bro
+ 1
A͢J - S͟o͟l͟o͟H͟e͟l͟p͟e͟r͟
I was just giving ideas for temporary solutions
:D
+ 1
HrCoder
One mistake it should be "inside the single quotes or double quotes"
+ 1
litre < - as. integer litre) ♂️🌎
0
Litre values comes float so i use integer...
0
Ok
0
AML Yakin
You have to convert litre to gallon and gallon can be in float.
0
change 1st line
x <- 2.5
0
Ok it's my mistake
0
A͢J - S͟o͟l͟o͟H͟e͟l͟p͟e͟r͟ No , i was just giving him an example to covert float to int
0
HrCoder
Ok then good
0
I complete that task with all of you
0
A͢J - S͟o͟l͟o͟H͟e͟l͟p͟e͟r͟ sorry for that
I thought " is called semicolons mistakenly 😨