answersLogoWhite

0

a = 0

while a < 10 :

a += 1

print (a)

Write the above simple script in a text editor (I use nano). Save as loop.py in home folder. To run, open a terminal and at the prompt, write: python loop.py

Result:

rodney@downstairs:~$ python loop.py

1

2

3

4

5

6

7

8

9

10

User Avatar

Wiki User

12y ago

What else can I help you with?

Continue Learning about Engineering

What does the print command do in Python?

The print command is a way to display output to the console. The hello world program, for example, can be written in python as simply print("Hello world") Other values can also be used in a print statement: a = 4 print(a) #will print the number 4


How do you loop a program in python 3?

A program can be looped in Python by wrapping the entire program in a for or while loop. If you wish to loop the program a finite amount of times, it can be done like so (x = the amount of times you want it to loop, this can be a number or variable storing a number): for i in range(0,x): [code] If you wish to loop the program infinitely, you can use a simple while loop: while True: [code]


Do you need Python in your PC?

Python is just a programming software, you don't actually need it to run your computer. You can use Python if you'd like to program something, or learn how to program.


How write a program to input any number and display digits which are absent in given number?

To write a program that inputs a number and displays the digits absent in it, you can follow these steps: Convert the input number into a set of its digits. Create a set of all possible digits (0-9). Subtract the set of digits from the complete set to find the missing ones. Display the missing digits. Here’s a simple example in Python: number = input(&quot;Enter a number: &quot;) present_digits = set(number) all_digits = set('0123456789') missing_digits = all_digits - present_digits print(&quot;Missing digits:&quot;, ''.join(missing_digits))


How do you open a Python program with MS-DOS?

open MS-DOS in the directory you have the python file in. type "python [INSERTNAMEOFSCRIPT]"

Related Questions

What does the print command do in Python?

The print command is a way to display output to the console. The hello world program, for example, can be written in python as simply print("Hello world") Other values can also be used in a print statement: a = 4 print(a) #will print the number 4


How do you loop a program in python 3?

A program can be looped in Python by wrapping the entire program in a for or while loop. If you wish to loop the program a finite amount of times, it can be done like so (x = the amount of times you want it to loop, this can be a number or variable storing a number): for i in range(0,x): [code] If you wish to loop the program infinitely, you can use a simple while loop: while True: [code]


What has the author Wesley Chun written?

Wesley Chun has written: 'Python fundamentals' -- subject(s): Python (Computer program language) 'Core Python programming' -- subject(s): Python (Computer program language)


Do you need Python in your PC?

Python is just a programming software, you don't actually need it to run your computer. You can use Python if you'd like to program something, or learn how to program.


How write a program to input any number and display digits which are absent in given number?

To write a program that inputs a number and displays the digits absent in it, you can follow these steps: Convert the input number into a set of its digits. Create a set of all possible digits (0-9). Subtract the set of digits from the complete set to find the missing ones. Display the missing digits. Here’s a simple example in Python: number = input(&quot;Enter a number: &quot;) present_digits = set(number) all_digits = set('0123456789') missing_digits = all_digits - present_digits print(&quot;Missing digits:&quot;, ''.join(missing_digits))


How do you open a Python program with MS-DOS?

open MS-DOS in the directory you have the python file in. type "python [INSERTNAMEOFSCRIPT]"


Where does the program python run?

Python is a runtime interpreter. It usually runs on the web server.


Program for generate multiples of 9 upto 500 using PYTHON?

In order to display multiples of 9 up to 500 I would use a while loop with the condition number &lt; 500. For example: #set number to the first multiple of 9 number = 9; while number &lt; 500: print number; #add 9 to the number number += 9; Note: I put semicolons at the end of each line out of habit. Python does not require this. Note: lines beginning with # are comments The above code will print the current value of number, then add 9 to it. It will continue to do this until number is greater than or equal to 500.


Where did the computer language called PYTHON get its name?

Python is named after the comedy troupe Monty Python, not the genus of snake. The creators of Python intended it to be fun to program in, and hoped to reflect that in its name.


What is the difference between strings and lists in Python?

They have different methods, and they display differently when printed.


How do you convert float into string in python program?

str(3.1415)


How do you program a python 488p car alarm?

488P Is the remote to a Python car alarm, need to be more specific on the alarm you have.