1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
zzz [600]
3 years ago
7

) Printing odd numbers. Write Python code that asks the user for a positive number, then prints all the odd numbers from 0 to th

e number provided by the user. For example, if the user provides the number 7, then you should print the values: 1 3 5 7 *You can use 'range()' with three numbers.
Computers and Technology
1 answer:
Mama L [17]3 years ago
3 0

Answer:

#here is code in Python

#read the value of n

n=int(input("enter a number:"))

#print all the odd numbers

for i in range (1,n+1,2):

   print(i,end = '')

Explanation:

Read a number from user and assign it to variable "n".Then use a for loop to print all the odd numbers from 1 to n.We can use range() function to print this. here first number is starting of the range and second will be the end of the range. and 3rd one is the Increment to the iterator.

For example In the above code, 1 is the start point and n+1 will be the last. Here

loop will run till n only.Every time value of "i" is increased by 2.

Output:

enter a number:15

1 3 5 7 9 11 13 15

You might be interested in
How are < embed > tags used in web page creation?
yKpoI14uk [10]

Answer:

The <embed> HTML element embeds external content at the specified point in the document. This content is provided by an external application or other source of interactive content such as a browser plug-in.

Explanation:

7 0
2 years ago
What data unit is encapsulated inside a packet?
viva [34]

Answer: datagram

Explanation:

7 0
3 years ago
Read 2 more answers
Round 74,361 to the nearest 10​
grandymaker [24]

Answer:

74,400 i think

Explanation:

8 0
3 years ago
What are the steps to configure user information in a document?
chubhunter [2.5K]

Answer:

file, properties, options, general

Explanation:

4 0
3 years ago
Read 2 more answers
Which of these completes the sentence? People interpret information ___________. Choose one.
evablogger [386]

Explanation:

mannejaondpsbma0jdjdhdj

5 0
3 years ago
Read 2 more answers
Other questions:
  • Jose calls you at the help desk because he is having a problem logging on to his laptop computer. After several unsuccessful att
    14·1 answer
  • PLC software does not typically fail or break​
    15·1 answer
  • What is microsoft excel
    12·1 answer
  • How many fonts are there in a theme?<br> A. 1<br> B. 2<br> C. 4<br> D. 5
    10·1 answer
  • Plz help ASAP
    10·1 answer
  • How is the EF​ computed? A. ES​ + Activity time B. LF minusActivity time C. ​Min{LS of all immediate following​ activities} D. ​
    11·1 answer
  • write a simple assembly code using 8088 microprocessor instruction set to add two numbers ? please help me if you know :(​
    11·1 answer
  • Which statements describe the use of styles in Word? Check all that apply.
    11·2 answers
  • ____ steganography places data from the secret file into the host file without displaying the secret data when you view the host
    9·1 answer
  • Who here has an old (preferably 80s) Toyota Celica i just bought mine and want to know how you guys like yours because mine is f
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!