Write a program that will ask the user to input the names

Assignment Help Python Programming
Reference no: EM132095133

Please do the coding in Python!

Write a program that will ask the user to input the names of cities they would like to visit.

This means that the program should ask the user first how many cites they want to input (function - AskForNumberCities).

Then the program should allow the user to input this and only this number of cities (function - AskForCityName).

If they input the same city name you should not count that as one of the cities. You only need to consider cities spelled EXACTLY the same way (e.g. Haifa and Haifa). Do not worry about upper and lowercase characters in city names.

After all the cities have been collected the program should then print a sentence that looks exactly like the following (function - PrintFirstCitySentence):

"You would like to visit Tel Aviv as city 1 and Haifa as city 2 and Negev as city 3 on your trip."

Next the program will take this sentence string and add 1 to each city number and then output the string with the changes (function - PrintAddOneCityNumSentence). For example,

"You would like to visit Tel Aviv as city 2 and Haifa as city 3 and Negev as city 4 on your trip."

NOTE: To do this I am requiring that you take the first sentence, split this sentence into a list, use isdigit() to determine if element of list is digit, add one to these elements, and join the new list elements together using join().

Since we just learned how to use the for loop and for loop with enumerate I am also requiring that you loop using for loops to show that you know how to use them. You may also use while loops where needed.

Remember, to find these built-in methods for a string type do the following:

>>> string_1 = 'hello'

>>> dir(string_1)

['__add__', '__class__', '__contains__', '__delattr__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__getslice__', '__gt__', '__hash__', '__init__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '_formatter_field_name_split', '_formatter_parser', 'capitalize', 'center', 'count', 'decode', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'index', 'isalnum', 'isalpha', 'isdigit', 'islower', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']

Reference no: EM132095133

Questions Cloud

Professional recommendation that summarizes and captures : A successful answer must be a professional recommendation that summarizes and captures all the information provided. Although there is not a specific page count
Display the menu and then execute the users choice : Display the menu and then execute the user's choice. Keep displaying the menu (and executing the user's choice) until the user chooses Option 5.
Write a loop to do the above summation more efficiently : Write a line of code on the blank line that will create a loop that will end when y is greater than 100.
Discuss the likelihood of stonyfield : Discuss the likelihood of Stonyfield having a strong influence on Danone's sustainability practices over the long term.
Write a program that will ask the user to input the names : Write a program that will ask the user to input the names of cities they would like to visit.
Terms of document design : Review the following documents and discuss which version is more effective in terms of document design, and why.
Develop a caesar cipher-type encryption algorithm : Develop a Caesar cipher-type encryption algorithm with a little more complexity in it.
Write a program that simulates a basic lottery : Your user will "purchase" one lottery ticket. Each ticket will contain 5 numbers. Each number will be between 1 and 20, inclusive.
Recommend to the executive team : If you were Henrietta what would you recommend to the executive team? Why? Back up your recommendations with detailed facts, information

Reviews

Write a Review

Python Programming Questions & Answers

  Write a python program to implement the diff command

Without using the system() function to call any bash commands, write a python program that will implement a simple version of the diff command.

  Write a program for checking a circle

Write a program for checking a circle program must either print "is a circle: YES" or "is a circle: NO", appropriately.

  Prepare a python program

Prepare a Python program which evaluates how many stuck numbers there are in a range of integers. The range will be input as two command-line arguments.

  Python atm program to enter account number

Write a simple Python ATM program. Ask user to enter their account number, and print their initail balance. (Just make one up). Ask them if they wish to make deposit or withdrawal.

  Python function to calculate two roots

Write a Python function main() to calculate two roots. You must input a,b and c from keyboard, and then print two roots. Suppose the discriminant D= b2-4ac is positive.

  Design program that asks user to enter amount in python

IN Python Design a program that asks the user to enter the amount that he or she has budget in a month. A loop should then prompt the user to enter his or her expenses for the month.

  Write python program which imports three dictionaries

Write a Python program called hours.py which imports three dictionaries, and uses the data in them to calculate how many hours each person has spent in the lab.

  Write python program to create factors of numbers

Write down a python program which takes two numbers and creates the factors of both numbers and displays the greatest common factor.

  Email spam filter

Analyze the emails and predict whether the mail is a spam or not a spam - Create a training file and copy the text of several mails and spams in to it And create a test set identical to the training set but with different examples.

  Improve the readability and structural design of the code

Improve the readability and structural design of the code by improving the function names, variables, and loops, as well as whitespace. Move functions close to related functions or blocks of code related to your organised code.

  Create a simple and responsive gui

Please use primarily PHP or Python to solve the exercise and create a simple and responsive GUI, using HTML, CSS and JavaScript.Do not use a database.

  The program is to print the time

The program is to print the time in seconds that the iterative version takes, the time in seconds that the recursive version takes, and the difference between the times.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd