Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

############Challenge 1 ######### # suppose you wanted to add a sequence of numbers together and get a sum. # the sequence is made of contiguous

############Challenge 1 ######### # suppose you wanted to add a sequence of numbers together and get a sum. # the sequence is made of contiguous numbers, # write code to sum a sequnce of numbers. Ask a user a starting number and how #many consecutive numbers to sum together ## HINT: Initialize a variable to hold the total by first assigning the #variable to 0. Then do your math and assign the total to it. """ Expected Output What is your starting number? 1 How many numbers in the sequence? 10 The sum of nmbers from 11 to 10 is 55

###########Challenge 1 Code Below ######################## print ("The Sum of Numbers from", counter, "to", ending, "is", total)

############Challenge 2 ######### #Suppose you have a list of cars named cars. # Write a short piece of code using a for loop to print out the entire list """ Expected output Ford Chevrolet Dodge Range Rover BMW Mercedes Toyota Nissan Kia w""

###########Challenge 2 Code Below ######################## cars=["Ford", "Chevrolet", "Dodge", "Range Rover", "BMW", "Mercedes", "Toyota", "Nissan", "Kia"]

############Challenge 3 ######### # Once you get the loop to print out the entire list, the challenge is to #start with the first car manufacturer in the list and print out every other # manufacturer #HINT: use the range() function to help you """ expected Output Ford Dodge BMW Toyota Kia

""" ###########Challenge 3 Code Below ########################

############Challenge 4 ######### #Now use the same code as challenge 3 and start from the second manufacturer # and print out every other manufacturer """ expected output Chevrolet Range Rover Mercedes Nissan

""" #########77##Challenge 4 Code Below #### ####################

############Challenge 5 ######### # using a for loop, print out a set of even numbers from 0 to 20, then reuse the code to print a set of odd nbumbers from 0 to 20 """Expected Output - Even 2 4 6 8 10'Baltimore': 'Baltimore Orioles', 'Boston': 'Boston Red Sox', 'New York City Bronx': 'New York Yankees', 'St. Petersburg': 'Tampa Bay Rays', 'Toronto': 'Toronto Blue Jays', 'Chicago': 'Chicago Cubs', 'Cleveland': 'Cleveland Indians', 'Detroit': 'Detroit Tigers', 'Kansas City': 'Kansas City Royals', 'Minneapolis': 'Minnesota Twins', 12 (Print) 14 16 18 20 Expected Output Odd 1 3 5 7 9 11 13 15 17 19

""" ###########Challenge 5 Code Below ########################

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

AutoCAD Database Connectivity

Authors: Scott McFarlane

1st Edition

0766816400, 978-0766816404

More Books

Students also viewed these Databases questions

Question

c. What were you expected to do when you grew up?

Answered: 1 week ago