Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Amalie Rønning
ITGK 2021 magnustvilde forelesningskode
Commits
f8a3390a
Commit
f8a3390a
authored
Aug 26, 2021
by
Magnus Tvilde
Browse files
Oppsummering kode uke34
parent
ee0e8e35
Changes
1
Show whitespace changes
Inline
Side-by-side
uke34/uke34.py
0 → 100644
View file @
f8a3390a
''' UKE 34 '''
# Oppsummering kode: Hva ble gjennomgått denne uken?
# interaktiv modus
#Kjør kode direkte, test kode hurtig
# aritmetiske uttrykk
pluss
=
9
+
4
minus
=
9
-
4
gange
=
9
*
4
dele
=
9
/
4
heltallsdivisjon
=
9
//
4
modulo
=
9
%
4
# print-funksjonen
print
(
'Hello World!'
)
# input-funksjonen
a
=
input
(
'Skriv noe: '
)
# variabler
tekst
=
'tekst'
tall
=
9
# datatyper: string, int, float, boolean
string
=
'en tekststreng'
integer
=
5
flyttall
=
5.4
sant
=
True
# f-string
print
(
f
'2+5 =
{
2
+
5
}
'
)
variabel
=
0.5685343
print
(
f
'
{
variabel
}
avrundet:
{
variabel
:
.
1
f
}
'
)
print
(
f
'
{
variabel
}
i prosent:
{
variabel
:
.
0
%
}
'
)
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment