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
Based on the unit content and your own ideas, how would you define a video game in your own words? What separates a regular vide
lara31 [8.8K]

Answer:

A video game would be a series of steps to produce or outcome / end in the form of controller a character or the how the game can be played and being able to play it at some level, but a good game would have multiple questions and a hard difficulty maybe even a customizable section for your character or object. In other words a Video game would be a series of steps to produce a outcome from controlling a character and a Good video game would be the same but added a level of difficulty and harder mechanics into the game.

Explanation:

Hope this helped :)

3 0
3 years ago
Harry is creating a PowerPoint presentation and wants all the slides to have a uniform look.
Ne4ueva [31]

Answer:

✔ Slide Master view

✔ layout and theme

✔ PowerPoint template

Explanation:

On Edg

4 0
3 years ago
Which of these is NOT a sign that someone might be drunk
earnstyle [38]

Answer:

what are the signs someone would or would not be drunk

7 0
4 years ago
Read 2 more answers
PLEASE HELP ASAP I WILL GIVE BRAINLIEST TO CORRECT ANSWER
salantis [7]
The correct answer is letter b
8 0
3 years ago
Read 2 more answers
This type of software can be described as end user software and is used to accomplish a variety of tasks. communications system
dezoksy [38]
This answer to this question is System
3 0
3 years ago
Other questions:
  • What is life all about?
    15·2 answers
  • Written and artistic expressions are protected by
    8·1 answer
  • BRAINLIEST !!A game design document is like a diary for game developers.
    11·1 answer
  • Convert hexadecimal number 1AF2 to a decimal number.
    7·1 answer
  • Translate We get up at 8 o'clock into Spanish in the box below:​
    9·1 answer
  • Describe a way that you can envision using the power of the computer through
    13·1 answer
  • Write a for loop with a range function that prints the following output. Name the target variable number. 0 1 2 3 4 5
    6·1 answer
  • Help please!! worth 10 pts! answer quick please!
    12·1 answer
  • Justine was interested in learning how to play the piano. She has successfully passed every level of music book and is planning
    10·1 answer
  • Pls need this asap
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!