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)

5th Sep 2021, 1:28 PM
Amala Yakin
23 ответов
+ 2
Alexander Shensnevich print should be in small letter . Hello world should be inside the ✖️semicolons ✔️ single or double quotes
6th Sep 2021, 1:56 AM
Pariket Thakur
Pariket Thakur - avatar
+ 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.
5th Sep 2021, 2:12 PM
A͢J
A͢J - avatar
+ 2
AML Yakin You don't need to convert litre in integer. Practice description didn't say anything. Check my previous answer again.
5th Sep 2021, 1:48 PM
A͢J
A͢J - avatar
+ 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)
5th Sep 2021, 1:52 PM
Pariket Thakur
Pariket Thakur - avatar
+ 2
AML Yakin Here is right solution: x <- readLines('stdin') litre <- as.integer(x) print(litre * 3.785)
5th Sep 2021, 1:55 PM
A͢J
A͢J - avatar
+ 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
5th Sep 2021, 1:44 PM
A͢J
A͢J - avatar
+ 1
SoloProg Why x <- 2.5?
5th Sep 2021, 1:53 PM
A͢J
A͢J - avatar
+ 1
Thx bro
5th Sep 2021, 2:13 PM
Amala Yakin
+ 1
A͢J - S͟o͟l͟o͟H͟e͟l͟p͟e͟r͟ I was just giving ideas for temporary solutions :D
5th Sep 2021, 2:59 PM
SoloProg
SoloProg - avatar
+ 1
HrCoder One mistake it should be "inside the single quotes or double quotes"
6th Sep 2021, 2:07 AM
A͢J
A͢J - avatar
+ 1
litre < - as. integer litre) ♂️🌎
6th Sep 2021, 2:13 AM
Shubham Bhatia
Shubham Bhatia - avatar
0
Litre values comes float so i use integer...
5th Sep 2021, 1:46 PM
Amala Yakin
0
Ok
5th Sep 2021, 1:49 PM
Amala Yakin
0
AML Yakin You have to convert litre to gallon and gallon can be in float.
5th Sep 2021, 1:49 PM
A͢J
A͢J - avatar
0
change 1st line x <- 2.5
5th Sep 2021, 1:50 PM
SoloProg
SoloProg - avatar
0
Ok it's my mistake
5th Sep 2021, 1:50 PM
Amala Yakin
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
5th Sep 2021, 1:56 PM
Pariket Thakur
Pariket Thakur - avatar
0
HrCoder Ok then good
5th Sep 2021, 1:57 PM
A͢J
A͢J - avatar
0
I complete that task with all of you
5th Sep 2021, 1:59 PM
Amala Yakin
0
A͢J - S͟o͟l͟o͟H͟e͟l͟p͟e͟r͟ sorry for that I thought " is called semicolons mistakenly 😨
6th Sep 2021, 2:13 AM
Pariket Thakur
Pariket Thakur - avatar