Skip to content
Snippets Groups Projects
Commit 08988b99 authored by Esther Voigt's avatar Esther Voigt
Browse files

Possible Results for the exercises in the julia course: FirstSteps.jl

parent c0ae166d
No related branches found
No related tags found
No related merge requests found
"""
Results of the exercises in the julia course: FirstSteps.jl
"""
# Please set your working directory
swd("/home/ev20kube/Dokuments/Julia/orWehreverYourProjectIs")
# What is the purpose of an apostrophe? (‘)
# press ? in the REPL and find out that it is a conjugate transposition operator :)
# Update your packages
# press ] in the REPL and then tip 'update'
# or tip Pkg.update() in the REPL
# install packages
# 1. use the package manager in the REPL: ]add "Plots"
# install pkg in the REPL: using Pkg; Pkg.add("Distributions")
# Build an array with 20 normal distributed numbers
x = randn(1000)
# How would you make a histogram with 1000 random numbers?
import Pkg
using Plots
histogram(randn(1000))
#If a is set as a=true and afterwards b is set to b=!!!!a then what is the value of b? (true, false, or error?)
a = true
b = !!!!a
#Build an array with 10 random numbers between 1 and 10
a = rand(1:10,10)
println(a)
# print values smaller than 5, with the text:
# “The value … is smaller than 5”
for i in 1:length(a)
if a[i] < 5
println("The value $(a[i]) is smaller than 5")
end
end
# Build an function that only print x, y, z if the values of all variables are not 0.
# In the case they are all 0, the function should print “Origin”.
function coordinates(x, y, z)
if x==0 && y==0 && z==0
println("origin")
else
println("($x, $y, $z)")
end
end
coordinates(0,0,2)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment