Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PythonIntro
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PythonDataScienceMatSci
PythonIntro
Commits
7a1c758f
Commit
7a1c758f
authored
Nov 11, 2022
by
Ulrich Kerzel
Browse files
Options
Downloads
Patches
Plain Diff
add examplel for a stand-alone python file
parent
2b82a7c9
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
pythonintro/Python_Skeleton_Simple.py
+14
-0
14 additions, 0 deletions
pythonintro/Python_Skeleton_Simple.py
pythonintro/solutions/Fibonacci.py
+35
-0
35 additions, 0 deletions
pythonintro/solutions/Fibonacci.py
with
49 additions
and
0 deletions
pythonintro/Python_Skeleton_Simple.py
0 → 100644
+
14
−
0
View file @
7a1c758f
##
## define relevant functions and/or classes
##
# ... your code goes here ...
##
## Main program
## Python uses the name to indicate the main program. If the program is executed, the code below is called.
##
if
__name__
==
'
__main__
'
:
# ... your code goes here ...
This diff is collapsed.
Click to expand it.
pythonintro/solutions/Fibonacci.py
0 → 100644
+
35
−
0
View file @
7a1c758f
##
## define relevant functions
##
def
compute_Fibonacci
(
n_numbers
):
return_list
=
[
0
,
1
]
for
i
in
range
(
2
,
n_numbers
,
1
):
Fib
=
return_list
[
i
-
1
]
+
return_list
[
i
-
2
]
return_list
.
append
(
Fib
)
return
return_list
##
## Main program
## Python uses the name to indicate the main program. If the program is executed, the code below is called.
##
if
__name__
==
'
__main__
'
:
# get 10 Fibonacci numbers
Fib
=
compute_Fibonacci
(
n_numbers
=
10
)
# write the Fibonacci numbers to a file
with
open
(
'
fibonacci.txt
'
,
'
w
'
)
as
f
:
for
number
in
Fib
:
f
.
write
(
str
(
number
)
+
'
\n
'
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment