-
-
Save TheMuellenator/febd64195828e681985a0746f0908f92 to your computer and use it in GitHub Desktop.
//Don't change this | |
var stockTickers: [String: String] = ["APPL" : "Apple Inc", "HOG": "Harley-Davidson Inc", "BOOM": "Dynamic Materials", "HEINY": "Heineken", "BEN": "Franklin Resources Inc"] | |
//Write your code here. | |
stockTickers["WORK"] = "Slack Technologies Inc" | |
stockTickers["BOOM"] = "DMC Global Inc" | |
//Don't modify this | |
print(stockTickers["WORK"]!) | |
print(stockTickers["BOOM"]!) |
I wrote :
stockTickers["WORK"] = "Slack Technologies Inc"
stockTickers.updateValue("DMC GLOBAL Inc", forKey:"BOOM")
however, I get an error "command not found" when I try to run the code, can anyone explain what I'm doing wrong? Do we need a function to update the tickers?
func exercise() {
//Don't change this
var stockTickers: [String: String] = [
"APPL" : "Apple Inc",
"HOG": "Harley-Davidson Inc",
"BOOM": "Dynamic Materials",
"HEINY": "Heineken",
"BEN": "Franklin Resources Inc"
]
stockTickers["WORK"] = "Slack Technologies lnk"
stockTickers["BOOM"] = "DMC Global lnk"
//Don't modify this
print(stockTickers["WORK"]!)
print(stockTickers["BOOM"]!)
}
//This Worked Properly
func exercise() {
//Don't change this
var stockTickers: [String: String] = [
"APPL" : "Apple Inc",
"HOG": "Harley-Davidson Inc",
"BOOM": "Dynamic Materials",
"HEINY": "Heineken",
"BEN": "Franklin Resources Inc"
]
//Write your code here.
func updateMyTickers() {
stockTickers["WORK"] = "Slack Technologies Inc"
stockTickers["BOOM"] = "DMC Global Inc"
}
updateMyTickers()
//Don't modify this
print(stockTickers["WORK"]!)
print(stockTickers["BOOM"]!)
}
func exercise() {
//Don't change this
var stockTickers: [String: String] = [
"APPL" : "Apple Inc",
"HOG": "Harley-Davidson Inc",
"BOOM": "Dynamic Materials",
"HEINY": "Heineken",
"BEN": "Franklin Resources Inc"
]
//Write your code here. 👇
stockTickers = [
"BOOM": "DMC Global Inc",
"WORK": "Slack Technologies Inc",
]
//Don't modify this
print(stockTickers["WORK"]!)
print(stockTickers["BOOM"]!)
}
// Don't change this
exercise()
This Worked for me , please don't take this serious :)
var stockTickers: [String: String] = ["APPL" : "Apple Inc", "HOG": "Harley-Davidson Inc", "BOOM": "Dynamic Materials", "HEINY": "Heineken", "BEN": "Franklin Resources Inc"]
func updateMyTickers() {
stockTickers["WORK"] = "Slack Technologies Inc"
stockTickers["BOOM"] = "DMC Global Inc"
}
updateMyTickers()
print(stockTickers["WORK"]!) print(stockTickers["BOOM"]!)
// i've maded like this and it's worked
//why did you use two dictionaries , when you can use only one
func exercise() {
//Don't change this
var stockTickers: [String: String] = [
"APPL" : "Apple Inc",
"HOG": "Harley-Davidson Inc",
"BOOM": "Dynamic Materials",
"HEINY": "Heineken",
"BEN": "Franklin Resources Inc"
]
//Write your code here. 👇
stockTickers = [
"WORK": "Slack Technologies Inc",
"BOOM": "DMC Global Inc",
]
//Don't modify this
print(stockTickers["WORK"]!)
print(stockTickers["BOOM"]!)
}
func exercise() {
//Don't change this
var stockTickers: [String: String] = [
"APPL" : "Apple Inc",
"HOG": "Harley-Davidson Inc",
"BOOM": "Dynamic Materials",
"HEINY": "Heineken",
"BEN": "Franklin Resources Inc"]
func updateMyTickers() {
stockTickers["WORK"] = "Slack Technologies Inc"
stockTickers.updateValue("DMC Global Inc", forKey: "BOOM")
//Don't modify this
}
updateMyTickers()
print(stockTickers["WORK"]!)
print(stockTickers["BOOM"]!)
var stockTickers: [String: String] = [
"APPL" : "Apple Inc",
"HOG": "Harley-Davidson Inc",
"BOOM": "Dynamic Materials",
"HEINY": "Heineken",
"BEN": "Franklin Resources Inc"
]
func ubdateMyTickers(){
stockTickers["WORK"] = "Slack Technologies Inc"
stockTickers["BOOM"] = "DMC Global Inc"
}
ubdateMyTickers()
print(stockTickers["WORK"]!)
print(stockTickers["BOOM"]!)
var stockTickers: [String: String] = [
"APPL" : "Apple Inc",
"HOG": "Harley-Davidson Inc",
"BOOM": "Dynamic Materials",
"HEINY": "Heineken",
"BEN": "Franklin Resources Inc"
]
stockTickers["WORK"] = "Slack Technologies Inc"
stockTickers["BOOM"] = "DMC Global Inc"
print(stockTickers["WORK"]!)
print(stockTickers["BOOM"]!)
// I wanted to see how the full dictionary looks like
print(stockTickers)
func exercise() {
var stockTickers: [String: String] = [
"APPL" : "Apple Inc",
"HOG": "Harley-Davidson Inc",
"BOOM": "Dynamic Materials",
"HEINY": "Heineken",
"BEN": "Franklin Resources Inc",
]
//Write your code here.
stockTickers["WORK"] = "Slack Technologies Inc"
stockTickers["BOOM"] = "DMC Global Inc"
//Don't modify this
print(stockTickers["WORK"]!)
print(stockTickers["BOOM"]!)
}
exercise()
func exercise() {
//Don't change this
var stockTickers: [String: String] = [
"APPL" : "Apple Inc",
"HOG": "Harley-Davidson Inc",
"BOOM": "Dynamic Materials",
"HEINY": "Heineken",
"BEN": "Franklin Resources Inc"
]
//Write your code here.
stockTickers["WORK"] = "Slack Technologies Inc"
stockTickers["BOOM"] = "DMC Global Inc"
//Don't modify this
print(stockTickers["WORK"]!)
print(stockTickers["BOOM"]!)
}
var stockTickers: [String: String] = ["APPL" : "Apple Inc", "HOG": "Harley-Davidson Inc", "BOOM": "Dynamic Materials", "HEINY": "Heineken", "BEN": "Franklin Resources Inc", ]
stockTickers["WORK"] = "Slack Technologies Inc"
stockTickers["BOOM"] = "DMC Global Inc"