python


How to make right looping through while?


I am trying to make looping. I want an output of number from 1-10 squared.
Here is my code. What is wrong?
for num in range(1, 10):
print (num)
while num < 100:
num = num ** 2
print(str(num))
Printing 1 to 10 squared would be like this:
for num in range(1,11):
print (num ** 2)
But if you wanted to print the number first and then the squared result you could do it like this
for num in range(1,11):
print (str(num) + ": " + str(num ** 2))
These are only suggestions, hope I helped!

Related Links

Why there are more python processes than the number of cores in Spark?
Filling in a completely empty list of lists in an arbitrary order
How to create random orthonormal matrix in python numpy
Fill an image with pre-defined pattern with Wand
How to use a post_save receiver with django-polymorphic?
giving a name to a pandas dataframe?
mistake comparing datetime, python
numpy testing assert array NOT equal
How to join threads of an asyncio executor runned inside coroutine?
Google Admin SDK insert custom schema using python
Importing images for manifold Isomap
Having nosetests watch files from outside container and rerun tests inside container
Trying to ftp from my system to remote server
Attribute in a Class immediately runs at the wrong time?
Unable to handle “HTTP Badstatus line” exception
How to merge/join two resultset/table in django?

Categories

HOME
xbox-live
paypal
laravel-5
freepascal
antivirus
firebase-app-indexing
google-tag-manager
extract
hana
rfc
console
algorithmic-trading
jpanel
simpy
internet-explorer-11
x11
google-shopping
cosmicmind
datagrip
sendkeys
r-lavaan
arraylist
grub2
chocolatey
device-detection
cvs2svn
plsqldeveloper
google-maps-android-api-2
epicor
fop
avplayeritem
searchbar
jflex
scalajs-react
net-snmp
owl-api
ipfw
pyscripter
graph-databases
shapes
swiftcharts
data-extraction
passenger
boilerplate
jrules
android-maps-v2
bids
php-ews
dojox.grid.datagrid
estimation
lumen-5.3
azure-availability-set
gauss
decompress
jexl
iphone-developer-program
opencpu
libreadline
spring-ioc
mix
spark-cassandra-connector
multiple-file-upload
gmsmapview
date-format
mpeg-4
qt-linguist
brackets-shell
self-hosting
file-diffs
coldfusion-7
data-import
vips
anti-patterns
subresource-integrity
mogrify
connection-reset
mdm-zinc
robocode
sysctl
left-recursion
node-imagemagick
system.web
ember-addon
roxygen
chrome-for-android
sim900
facebook-sdk-3.1
asp.net-mvc-scaffolding
windows-update
sharpmap
fortran77
code-conversion
dropdownlistfor
crocodoc
sequelpro
moq-3
javascriptserializer
sunspot-rails
shim
flexicious
easygui
printing-web-page
gethashcode
mvvm-foundation
lazy-c++
data-entry
dotproject

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App