In November, Sweden's prime minister, Magdalena Andersson resigned just hours after being elected. Was her reign the shortest of any nationally-elected executive? Have any leaders, in any other country, served shorter terms?
This is a misunderstanding of the Swedish system. Magdalena Andersson did not actually serve as prime minister after the first election. There was no formal transfer of power from Stefan Löfven to her (skifteskonselj) before she "resigned", so she has only formally been prime minister since the transfer of power taking place on the 30th of November, after the second time she was elected by the parliament.
The "seven hour term" should more properly be interpreted as a period of seven hours during which she was nominated by the parliament to take over, but elected to decline after one of her allies elected to not remain in a coalition with her.
The question is rather unclear, but if we stick roughly to a position called PM and some kind of election being involved... Siaka Stevens' 1967 "premiership" (in Sierra Leone) probably qualifies, although it was "ended" (or rather interrupted) by a coup, not withdrawal of support (even informal).
In elections held on 17 March 1967, the APC won by an extremely narrow margin, and Stevens was appointed Prime Minister, but he was arrested in only an astonishing several minutes after taking office during a military coup.
After a brief period of military rule, Stevens reassumed the post of Prime Minister on 26 April 1968.
Accounts of those events probably vary somewhat, but according to a Time article from 1968, Stevens only formally held power for 10 minutes in 1967 before he was deposed by the junta. According to other sources though Stevens' "arrest took place prior to the announcement of the election result." Looking at one of the sources cited for the latter, the "announcement" seems to refer to radio announcement; Brigadier David Lansana, who led the coup and ordered Stevens' arrest, also took over the radio stations. (Lansana was himself fairly quickly overthrown by other officers a few days later, resulting in Brigadier Andrew Juxon-Smith assuming power on March 27. Juxon-Smith himself was eventually overthrown by lower-ranking officers, who returned Stevens to power, more than a year later after the Lansana coup.)
As I suspect many similar examples involve coups deposing an elected government, it really depends on whether we count de fact vs de jure government etc.
And whether Stevens is a valid example also depends on whether the question is asking about the shortest term or the shortest career as PM, in case someone served multiple terms, as was the case with Stevens actually.