Skip to content
Snippets Groups Projects
Select Git revision
  • 5ca2a5312613867125b35a75b1d939a07828740a
  • master default protected
  • dev
3 results

scrap

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    Results.jl 1.38 KiB
    """
    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)