Machine Problem 2
Create a Python script that will generate random n integers from a given start and end of a range.
Sample Output:
Value for n :5
Value for start: 1
Value for end : 10
10 8 7 8 3
Machine problem 3
In the game Rock Paper Scissors, two players simultaneously choose one of the three options: rock, paper, scissors. If both player choose the same option, then the result is a tie. However, if they choose differently, the winner is determined as follows:
• Rock beats scissors, because a rock can break a pair of scissors
• Scissors beats paper, because scissors can cut paper
• Paper beats rock, because a piece of paper can cover a rock
Create a Python script in which a computer randomly choose rock, paper or scissors. Let the user enter a number 1, 2, or 3 each representing one of the three choices. Then, determine the winner.
Machine Problem 1
Number Guessing Game
In the number guessing game, the computer will randomly select a number from a range of numbers e.g. 1-100 and then the game will give the player five attempts to guess the number.
Gameplay:
• If the player's guess is higher than the chosen number, the program will tell the player to try another LOWER than the previous guess.
• If the player's guess is lower than the chosen number, the program will tell the player to try another number HIGHER than the previous guess.
■ If the player guesses the number before he consumes the five attempts, then display congratulatory message.
Using Python class Person, write a program that will generate the output below:
Hello, my name is Bob and I am 25 years old!
input:The cat is on the mat.
output:
ehT tac si no eht .tamehT tac si no eht .tamusing split reverse the sentence without changing the order.
the first line contains an integer n denoting the number of rows in A. the next line contains an integer ,M, denoting the number of columns in A. Each line i of the N subsequent line (where 0<=i< N) comtains M space seperated integers each :describing the ith row of A
Write a program that takes a string as input and prints “Binary Number” if the string contains only 0s or 1s. Otherwise, print “Not a Binary Number”.
Question 2:
# Three Dice game
# import library
import random
# roll three dice and store the results in the variables
# Add the points from both dice
# display message to guide user on how to use this program
# If total is more than 9, it is 'big'. Else, it is 'small'
# prompt user to guess small or big.
# convert the user input to lower case
# check if the user input is valid
# if the answer was not either small or big,
# shows invalid guess message
# check the value of total
# if it is greater than 9, assign the correct answer as big
# else assign the answer as small
ABC Banking maintains a record of their clients accounts in a text file named "custBalances.txt" using the following format:
accNo,Lastname,Firstname,PIN,balance
ABC clients would like to have a means to know their balances conveniently.
Your task is to write a program that will access the data of the customer from the text file by supplying their account number and PIN code. Given a valid account number and PIN, program must display the customer information.
Your program must use the following function in a separate python file
Input
1. data
Output
Enter·account·number:·356662421
Account·does·not·exist.
Enter·account·number:·356662420
Enter·PIN:·1676
Account·No.:·356662420
Customer·Name:·Branden·Rivers
Balance:·PHP·49,316.00
Enter·account·number:·X
Good·Bye!
Enter·account·number:·X
Good·Bye!Your college has a logging system for students internet activities. Daly logs 1000 of entries and stored in internet file as 12 lines. One day the IT administrator want to analyse for recent activities done by students, so he needs to access log entries from bottom first. Write a python function file-end(file-name, n) which accepts file name, number of lines it will read from last and return them in string as shown in example. Also, write the exception handling code to show the proper message. Also, write the exception handling code to show the proper message. Do not use input function and give input values in fixed form.