Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SciProg2024
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pclark3
SciProg2024
Commits
a40fc1c0
Commit
a40fc1c0
authored
1 year ago
by
cprutean
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
3438a331
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
CodeExamples/ReadingandFormatFloats.ipynb
+56
-0
56 additions, 0 deletions
CodeExamples/ReadingandFormatFloats.ipynb
with
56 additions
and
0 deletions
CodeExamples/ReadingandFormatFloats.ipynb
0 → 100644
+
56
−
0
View file @
a40fc1c0
{
"cells": [
{
"cell_type": "markdown",
"id": "e955edf5",
"metadata": {},
"source": [
"# Reading and Format Floats"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "0aa26554",
"metadata": {},
"outputs": [],
"source": [
"\"\"\"\n",
" Starter Python programm to read in and print a 10^6 times the number then\n",
" the square of that in a single print statement.\n",
"\n",
"\"\"\"\n",
"\n",
"# Read in a float\n",
"x = float(input(\"Type in a floating point number : \"))\n",
"\n",
"x = x*1.0e6\n",
"y = x**2\n",
"\n",
"# Print it out\n",
"print(\"1 million time is : \" + str(x) + \" and the square of this is : \" + str(y))"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
%% Cell type:markdown id:e955edf5 tags:
# Reading and Format Floats
%% Cell type:code id:0aa26554 tags:
```
python
"""
Starter Python programm to read in and print a 10^6 times the number then
the square of that in a single print statement.
"""
# Read in a float
x
=
float
(
input
(
"
Type in a floating point number :
"
))
x
=
x
*
1.0e6
y
=
x
**
2
# Print it out
print
(
"
1 million time is :
"
+
str
(
x
)
+
"
and the square of this is :
"
+
str
(
y
))
```
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