Instructions Write python programs for the following.
1. Write a program to approximate
b
sin(x) = Σ
(-1)k (2k+1)!
x2k+1
k=0
where x,
b are inputs given by the user.
2. Write a program that interacts with the user in the following way.
(a) Prompt the user: "Enter a number: ". Accept a number n from the user.
(b) Print the first 5 multiples of that number (example: if the number is 2, then print "2, 4, 6, 8, 10")
(c) Prompt the user: "Continue (y/n)?". Accept an answer.
(d) If the answer is "y", print the next 5 multiples. Then repeat the prompt in step (c).
(e) If the answer is "n", then prompt: "Change numbers (y/n)?"
(f) If the answer is "y", start again from step (a).
(g) If the answer is "n", then exit the program.
3. The guessing game works as follows. The program generates a random number between 1 and 50. The user now has to guess what the number is. The interaction works as follows.
(a) A random number m is generated.
(b) Prompt the user: "Guess the number: ". Accept an input n from the user.
(c) If the number n is less then half of m, then output the message: "The number is much too small." Otherwise, output the message: "The number is too small." Repeat the prompt in step (b).
(d) If the number n is more than one and a half times of m, then output the message: "The number is way too big." Otherwise, output the message: "The number is too big." Repeat the prompt in step (b).
(e) If n is equal to m, then output: "You guessed correctly! Repeat the game? (y/n)". Accept an input from the user.
(f) If the input is "y", then repeat the game starting from step (a). If the input is "n", then exit the game.
Note: Random numbers can be generated using the following piece of code:
import random
random.randint (1,50) # Generates a random integer between 1 and 50
4. Write iterative Python programs (using while loops) for all problems of Assignment 2.
1
CS 340 Milestone One Guidelines and Rubric Overview: For this assignment, you will implement the fundamental operations of create, read, update,
Retail Transaction Programming Project Project Requirements: Develop a program to emulate a purchase transaction at a retail store. This
7COM1028 Secure Systems Programming Referral Coursework: Secure
Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip
CS 340 Final Project Guidelines and Rubric Overview The final project will encompass developing a web service using a software stack and impleme