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

415 error when uploading to API
How to interfacing
Collision detection with PyGame
Why is Python not setting up my cron job's time properly?[Solved]
Training Data Set in NLTK Python
Pip3 packages can't be found/used by the terminal
No recipients have been added when trying to send message with Flask-Mail
Get 503 response code from youtube, when scraping comments with python
Pip can't upgrade a built-in package in ubuntu 15.04
PyRun_SimpleString is blocking whenever import is used, never returns
What is the purpose of setuptools requirements of the form “package===version”
Django admin site not opening while running from pydev in eclipse
WebdriverWait is showing TimeoutException, if i use sleep.time it works ok
Python: Create Array from Indexed List
Overlaying n (user generated) points over a graph
How to get django model object in save method

Categories

HOME
crystal-reports
vue.js
cluster-computing
jenkins-plugins
google-tag-manager
apollo
appmaker
apple-numbers
xtext
histogrammar
java-home
data-science-experience
proguard
actionscript-2
octopus-deploy
android-source
sendkeys
scaling
tree-traversal
zend-framework-mvc
jsonserializer
statusbar
nmake
epicor
jquery-form-validator
avplayeritem
kitematic
continuous-deployment
branch
image-quality
classpath
vcard
frp
fileinfo
devforce
jackson-dataformat-csv
pari
percentage
consumer
web-audio-api
mms
poco-libraries
twiki
viewgroup
ttcn
context-free-language
lumen-5.3
web-deployment-project
azureportal
openh264
rxvt
libtiff.net
typhoon
picasa
audioqueue
scalar
freetype2
instruments
gherkin
nssplitview
mercurial-hook
coordinate-transformation
spring-lemon
remoteapp
asynccallback
asp.net-mvc-2
portfolio
loose-typing
geodjango
enyo
site-prism
programming-paradigms
team-build
xaml-designer
hiera
kallithea
activity-streams
argument-passing
roxygen
chrome-for-android
dynamic-proxy
baucis
cilk-plus
sql-server-2012-web
ruboto
surveyor-gem
lame
google-closure-library
iconv
symphony-cms
pep8
objcmongodb
sametime
gdataxml
couchdb-lucene
z-machine
text-services-framework
wchar
electronic-signature
iphone-sdk-3.2
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