PYTHON PROGRAMMING
Write a loop that prints each country's population in
country_pop.
Sample output with input:
'China:1365830000,India:1247220000,United
States:318463000,Indonesia:252164800':
United States has 318463000 people. India has 1247220000 people. Indonesia has 252164800 people. China has 1365830000 people.
country_pop={"United States": 318463000, "India" : 1247220000, "Indonesia" : 252164800, "China": 1365830000 } for key,value in country_pop.items(): print(key +" has "+ str(value) +" people.")
PYTHON PROGRAMMING Write a loop that prints each country's population in country_pop. Sample output with input:...
Python Programming Write a program that reads the dimension of a rectangle and prints its area. The program must handle errors such invalid input. If it encounters an error, it should ask the user to reenter the input. Sample run: Enter height:abc abc is not a vaid input. Try again. Enter height:10 Enter width:hello hello is not a vaid input. Try again. Enter width:world world is not a vaid input. Try again. Enter width:xyz xyz is not a vaid input....
Python programming: Write a while loop that prints a. All squares less than n. For example, if n is 100, print 0 1 4 9 16 25 36 49 64 81. b. All positive numbers that are divisible by 10 and less than n. For example, if n is 100, print 10 20 30 40 50 60 70 80 90 c. All powers of two less than n. For example, if n is 100, print 1 2 4 8 16...
DATA PROGRAMMING: PYTHON Be sure to use sys.argv NOT input. Write a program and create a function called inch2cm that takes one number in inches as a parameter, converts it to the centimeters and prints the result. The program output is shown below. Input: 14 Output: 14 inches = 35.56 centimeter Write a program and create the following functions: shapes(): takes the shape name and a number as parameters, and calls the proper function to calculate the area. areaCircle(): take...
Write a program that reverses a string and prints it on the screen. Sample input/output: Enter a string to be reversed: Testing the reverse string program reversed string: margorp gnirts esrever eht gnitseT
Python 3.7.4: Write a for loop that prints, in ascending order, all the positive multiples of 5 that are less than 175. Each value must be on a separate line.
Ex1 In Python Write a while loop that prints out a list containing the first 5 numbers that are multiples of 9 from 1 to 100. (Hint: use break statement) The output should be [9, 18, 27, 36, 45]
Loop Prints hand traced in python. What is the output? Instead of using newlines to separate, use comma to separate each line ie. (a,b,c,...) for i in range(1, 10): if i % 2 == 0: print(i, end=",")
Write a function in PYTHON that reads a sequence of numbers ended by 0 and prints “Sorted” if the numbers were input in increasing or decreasing order, otherwise the program must print “Not sorted” (Do not calculate 0) Sample Input 4 3 -1 -5 0 Sample Output Sorted
Write a programming java that prints the sum of cubes. Prompt for and read two integer values from the user and print the sum of each value raised to the third power, i.e., (?3+?3). Sample output: (user input) Enter x as an int: 3 Enter y as an int: 4 (3^3) + (4^3) = 91
I need help with this python programming exercise, please! thanks in advance Create a Python script file called hw4.py. Add your name at the top as a comment, along with the class name and date. Both exercises should be in this file, with a comment before each of them to mark it. Ex. 1. Write a program that inputs an integer number from the user, then prints a letter "O" in ASCII art using a width of 5 and the...