strings
strconv
+-------------------------+ | Miles: 50 | +-------------------------+ | Kilometers: 80.47 | +-------------------------+Miles will be input by the user, and kilometers should be formatted to 2 decimal places.
<!DOCTYPE html> <html> <head></head> <body> Miles: 50<br> Kilometers: 80.47 </body> </html>Feel free to use any HTML tags and CSS you may know.
$ distance_converter 50mi kmShould produce:
80.47kmIt should support miles (mi), kilometers (km), feet (ft) and meters (m).
ifmanwas meanttos tayonthe groundgo dwouldha vegivenu srootsThe coded message is obtained by reading down the columns going left to right. For example, the message above is coded as:
imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoauIn your program, have the user enter a message in english with no spaces between the words. Have the maximum message length be 81 characters. Display the encoded message. (Watch out that no "garbage" characters are printed.) Here are some more examples:
Input Output haveaniceday hae and via ecy feedthedog fto ehg ee dd chillout clu hlt io
make([]int, 3, 9)
?x := [6]string{"a","b","c","d","e","f"}what would
x[2:5]
give you?
x := []int{ 48,96,86,68, 57,82,63,70, 37,34,83,27, 19,97, 9,17, }
sum
is a function which takes a slice of numbers and adds them together. What would its function signature look like in Go?sum
functionhalf(1)
should return (0, false)
and half(2)
should return (1, true)
.makeEvenGenerator
as an example, write a makeOddGenerator
function that generates odd numbers.fib(0) = 0, fib(1) = 1, fib(n) = fib(n-1) + fib(n-2). Write a recursive function which can find
fib(n)
.defer
, panic
and recover
? How do you recover from a run-time panic?reverse([]int{1,2,3}) → []int{3,2,1}