+ 5
🔥🅳🅴🆅 🅼🅸🆂🅷🆁🅰🔥 did you mean to compare integers or words/strings
f = as.integer(f)
i = as.integer(i)
+ 3
= is assignment, not comparison
R does not use "or"
if you want to find the nth root of a number, you can calculate it as num^(1/nth)
if you take the nth root as integer (e.g. 2 instead of "square root"), you don't need the comparisons but use the number directly
have another look at booleans and comparison in R
+ 3
<- is assignment
Read the lesson on booleans and comparisons again
edit:
Dividing by 3 doesn't give the 3rd root of the number
+ 3
Do you understand what booleans are?
+ 3
What you probably want to do is the following:
if (1st input == "square root" || 1st input == "Square root" ...)
If (at least) one of the sub-statements evaluates to TRUE, you calculate the square root.
+ 3
You want to compare strings i the if-statement? But you convert the 1st input to a number in line 3?
+ 3
If f is an integer, it is a number like 1 or 2 or 3...
How would it this number ever be equal to "square root"?
+ 3
Compare:
f == "square root" == True (wrong)
f == "square root" (correct)
+ 2
Then you shouldn't convert the 1st input to integer but leave it as string...
+ 2
🔥🅳🅴🆅 🅼🅸🆂🅷🆁🅰🔥
I believe this is what you are looking for as one readLines input appeared as it was actually not working.
This still takes both inputs
The first as a string
The second as a numeric
https://code.sololearn.com/cdoimXH1Cm5b/?ref=app
+ 1
Hi
+ 1
I can do not understand in any basic html tag...
Please help me so i request...😣😞💔