Subscribe to:
Posts (Atom)
-
Feature Engineering for Time-Series Data Feature engineering is crucial for extracting meaningful insights from time-series data. Here are...
-
Tokenization and Embedding: Worked Example Tokenization and embedding are key steps in processing input sequences for transformers....
-
Searching for a Future in Nairobi The sun hung low over Nairobi’s skyline, casting long shadows acros...
-
### Tower of Hanoi Algorithm Editor: Zacharia Maganga Nyambu Email: nyazach@gmail.com The Tower of Hanoi is a classic algorithmic probl...
-
Linear Regression Concept Note Linear Regression Concept Linear regression is a statistical method t...
-
Planetary Data Planet Quick Facts Mercury Distance from Sun: 57.9 million km Orbit...
-
Multifeed Express Reverse Vending for Recycling π Multifeed Express Reverse Vending for Recycling The integration o...
Meet the Authors
Zacharia Maganga’s blog features multiple contributors with clear activity status.
Active ✔
π§π»
Zacharia Maganga
Lead Author
Active ✔
π©π»
Linda Bahati
Co‑Author
Active ✔
π¨π»
Jefferson Mwangolo
Co‑Author
Inactive ✖
π©π
Florence Wavinya
Guest Author
Inactive ✖
π©π
Esther Njeri
Guest Author
Inactive ✖
π©π
Clemence Mwangolo
Guest Author
Followers
Support This Blog
Tap Donate now here to donate or go to donate on top menu to scan QR and support this site.
Donate Now
3 comments:
> x
[1] 3 6 8
> y
[1] 2 9 0
> x + y
[1] 5 15 8
> x + 1 # 1 is recycled to (1,1,1)
[1] 4 7 9
> x + c(1,4) # (1,4) is recycled to (1,4,1) but warning issued
[1] 4 10 9
Warning message:
In x + c(1, 4) :
longer object length is not a multiple of shorter object length
# take input from the user
num = as.integer(readline(prompt="Enter a number: "))
# initialize sum
sum = 0
# find the sum of the cube of each digit
temp = num
while(temp > 0) {
digit = temp %% 10
sum = sum + (digit ^ 3)
temp = floor(temp / 10)
}
# display the result
if(num == sum) {
print(paste(num, "is an Armstrong number"))
} else {
print(paste(num, "is not an Armstrong number"))
}
> # create a list
> s <- list(name="John", age=21, GPA=3.5, country="France")
> # make it of the class InternationalStudent which is derived from the class student
> class(s) <- c("InternationalStudent","student")
> # print it out
> s
John
21 years old
GPA: 3.5
Post a Comment