Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1 . ( 7 points ) Implement a program that requests three strings from the user. Your program should concatenate the first two strings in
points Implement a program that requests three strings from the user. Your
program should concatenate the first two strings in the reverse order and compare
the concatenated string with the third string. If they are equal, your program
should print They are equal otherwise, the program prints They are not
equal A sample run is shown below:
Enter first string: you!
Enter second string: Thank
Enter third string: Thankyou!
They are equal
Enter string : you
Enter second string: Thank
Enter third string: Thankyou!
They are not equal
points Write a Python program that reads in integers or integers user first determines or integers and displays the following:
a the average of the numbers two decimal places suggested
b the maximum of the numbers
Do not use Pythons internal functions for average and maximum.
A sample run is shown below:
Enter set of integers:
Enter first number:
Enter second number:
Enter third number:
The average of and is:
The maximum of the three numbers is:
Enter set of or integers:
Enter first number:
Enter second number:
Enter third number:
Enter fourth number:
The average of and is:
The maximum of the three numbers is:
points An integer, greater than that is only divisible by and itself is called
a prime number. All other numbers greater than are called composite numbers.
The integers and are neither prime nor composite. Write a python program
that requests a positive integer from the user, determines if it is a prime,
composite or neither prime or composite and prints the message.
Sample runs are shown below:
Enter positive integer:
It is a prime
Enter positive integer:
It is a composite
Enter positive integer:
It is neither prime nor composite
Enter positive integer:
Error: You did not enter a positive integer
Enter positive integer:
Error: You did not enter a positive integer
Enter positive integer: Hi
Error: You did not enter a positive integer
points Implement a Python function with arguments called
SimpleInterestPrinciple Interest, Years The arguments are:
a A principle amount float
b Interest Rate to as a float
c Years integer
Your function should return the simple interest amount.
The formula for a simple interest is PrincipleInterestRateYears
Write your function definition in one cell and the function calling code below it or
in a different cell in Jupyter Notebook.
Your code should ensure that the user input is in the correct type and format
points Write a python program for a shopping cart. The program should allow
shopper to enter the product name and price. Use loop so that shopper can enter as
many inputs as necessary and validate the inputs as product name should be string
and price should be more than $ At the end, the output should
display the total the shopper needs to pay. Use fstring to format the total
value for two decimal points and comma.
print the name and price for all the entries with appropriate headings.
pointsRockpaperscissors is a hand game that is played by two people. The
players count to three in unison and simultaneously "throw" one of three hand
signals that correspond to rock, paper or scissors. The winner is determined by the
rules:
Rock smashes scissors
Scissors cuts paper
Paper covers rock
Rockpaperscissors is a surprisingly popular game that many people play
seriously see the Wikipedia article for details
Write a Python program to ask the users choice of Rock paper scissors. The
program then, randomly, chooses a choice for itself the computer and then
compares it with the users choice. The output should show, the users choice, the
programs choice and the winner.
Sample runs are shown below:
Enter your choice: rock
Computer chooses scissors
You, the user, win!
Enter your choice: paper
Computer chooses rock
I, the computer, win!
Enter your choice: scissors
Computer chooses scissors
User and computer tie!
Finally, you want to play at least times. Store and display the computer
choices and user inputs in a pandas dataframe with headings.
points Write a program where the user and the programcomputer play a
number guessing game. The program should prompt the user for a number
between and inclusive then the programcomputer has to guess what the
user entered. Keep track of the number of iterations it takes for the computer to
guess the number. Sample runs are shown below:
Enter number to be guessed:
You entered and it took the program iterations to guess
Enter number to be guessed:
You entered and it took the program iterations to guess
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started