Write the Python code of a program that get all the odd numbers between 10 and 50 (inclusive).
Output: 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49
hi so i think i got the code right but i am so confused with explanation todo i justy don't know how to name them this is my first time using this type usually is with print statement or i could name them whatever i want them . thanks for your help
#Todo
# assign the result str to variable r_str
# hint:
# 1. usr str() to change integer to string
# 2. remember to add space between numbers
# 3. there is no extra space before the first number, no space after the last number.
# 4. for 2 and 3, use if statement to add string differently.
def task6(num_1, num_2):
# YOUR CODE HERE
for i in range(10,51):
if i%2 != 0:
r_str = (i , end =="")
return r_str
this is the correct output "11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49"
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 1 images
- Write a Python program to calculate the gross pay for some employees as shown in the following run samples. Any hours worked over 30 are paid at time and a half (1.5 times the regular hourly rate) Run sample 1:Enter the number of employees: 2 Enter the hours worked by employee 1: 32 Enter the hours worked by employee 2: 20 Enter the hourly pay rate: 10 Gross pay for employee 1 with 2.0 hours overtime : $330.00 Gross pay for employee 2: $200.00Run sample 2: Enter the number of employees: 3 Enter the hours worked by employee 1: 30 Enter the hours worked by employee 2: 20 Enter the hours worked by employee 3: 10 Enter the hourly pay rate: 10 Gross pay for employee 1: $300.00 Gross pay for employee 2: $200.00 Gross pay for employee 3: $100.00arrow_forwardHow can I do coding for this question?arrow_forwardCan you use Python programming language to wirte this code? Thank you very much!arrow_forward
- Can you use Python programming language to to this question? Thanksarrow_forwardCan you use Python programming language to wirte this code? Thank you very much!arrow_forwardWrite a python program which creates and outputs variables of various types. For any lines of code which produce an error, comment out the line and add a comment indicating what the problem is with the line--not only what error message you got, but what it means (explain why). Make sure you do each of the following: set a variable to an Integer value set a variable to a a floating point value create a string using double quotes " which contains both single ' and double " quotes create a string using single quotes ' which contains both single ' and double " quotes create a string using triple single quotes '''' which contains both single ' and double " quotes create a string using triple single quotes """ which contains both single ' and double " quotes use the type conversion functions to convert: integer to float float to string string to integer 2 other type conversions Use the "print" function to output the value of each variable and use the type function to output the data…arrow_forward
- Write a Python program that asks the user to input 2 numbers. add the 2 numbers together print a statement that shows the 2 numbers that were entered and their sum. For instance, if I input 2 and 4 the output should say, "The sum of 2 and 4 is 6". It is probably easiest to use the repl.it web site....you can write your code and run it there - BUT - you have to turn in the code to Canvas. Just copy and paste the code into the assignmentarrow_forwardIn Java: Forms often allow a user to enter an integer. Write a program that takes in a string representing an integer as input, and outputs yes if every character is a digit 0-9. Ex: If the input is: 1995 the output is: yes Ex: If the input is: 42,000 or 1995! the output is: no Hint: Use a loop and the Character.isDigit() function.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education