Python Answers

Questions answered by Experts: 5 288

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search

Looking for someone to help me with my 30 questions timed final


import random



number_letter = ["One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten"]

numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]




#print(spell)

#print(number_letter[numbers.index(spell)])

score=0

wrong=0

tries = 3

question =0


while question <= 10:

spell: int = random.choice(numbers)

guess = input(f"Spell {spell}:")

right_answer = number_letter[numbers.index(spell)]


if guess == right_answer:

score= score +1

question= question +1

print("You spelled it right!")



else:

tries= tries - 1


print("Incorrect Spelling.",tries,"left")

if tries == 0:

wrong = wrong + 1

print("Number of trial Exceeded")



in this program i need to spell the number if its wrong it will have a 3 tries and if the 3 tries is over it will become wrong answer then the program will continue until the user solve 10 question. please help me


In a class of 'N' students each student is asked to bring number of dishes as per their roll number for example student of roll number1 will bring 1 item, roll number 2 brings 2 items and so on. Write a python function calc(N) that takes integer value N and returns the total number of items brought by N students. Do not input() function for taking input ,specify it in fixed form and also don't use advanced data type(i.e. list, tuple,set, dictionary)


Trapezium Order

You are given an integer N. Print N rows starting from 1 in the trapezium order as shown in the output of the below examples.

Input:

The input contains an integer N.

Output:

The output should have N lines.

Each of the N lines should have space-separated integers as per the trapezium order.

Sample Input:

4

Sample Output:

1 2 3 4 17 18 19 20

5 6 7 14 15 16

8 9 12 13

10 11



Calculate Manhattan distances between these pairs of points (total 10*10 = 100


pairs inlcuding self pairs).This should give you a 10*10 2-D array where each value


corresponds to the distance between a pair

Triplet Sum



Given an array n integers, find and print all the unique triplets (a, b, c) in the array which give the sum K. (a+b+c=K).Input





The first line of the input will be space separated integers, denoting the elements of the array. The second line of the input will be an integer denoting the required sum KOutput





The output should be multiple lines, each line containing a unique triplet. The elements of the triple must be sorted in increasing order and all the triplets printed must be sorted in increasing order. Print "No Matching Triplets Found" if there are no triplets with the given sum.Explanation





When the given array is [0, 1, 2, 3, 5, 7, 13, 17, 19, 19] and the required sum is 22, the triplets (0, 3, 19), (0, 5, 17), (1, 2, 19), (2, 3, 17) and (2, 7, 13) have the given sum 22.




Sample input 1:



0 1 2 3 5 7 13 17 19 19



22




Sample output 1:



(0, 3, 19)



(0, 5, 17)



(1, 2, 19)



(2, 3, 17)



(2, 7, 13)




Given a number and find the product of its digits as output . For example if the given number is 432 then output is 24 and another example if the given number is 110 then output is 0 and another example if the given number is 02 then the output is 2

how to write code for hollow rigth angled triangle with different shapes of three side of a triangle

In a class ,'N' students are asked to bring a number of dishes as per their roll numbers, for instance ,roll number 1 will bring 1 item, roll number 2 brings 2 items and so on. Write a python function calculate(N) which takes an integer value N and returns the total number of items brought by 'N' students. Do not use input() function for taking input from keyboard. Specify it in fixed form but function must be generalized. If you enter a negative number it should print (Enter a positive number) .

you are given an N*N matrix. Write a program to check if the matrix is unique or not. A unique matrix is a matrix if every row and column of the matrix contains all the integers from 1 to N.

INPUT:

4

1 2 3 4

2 3 4 1

3 4 1 2

4 1 2 3

OUTPUT- True.

INPUT:

4

1 2 3 3

2 3 4 1

3 4 1 2

4 1 2 3

OUTPUT- False


LATEST TUTORIALS
APPROVED BY CLIENTS