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

days= ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']

a= input()

b = int(input())

i = b % 7 -1 

if a in days:

  d = days.index(a)+i

if d >= 7:

  d = d - 7

print(days[d-1])

this code is not working

how to print days


You are given a list L. Write a program to print all numbers in the list which are exactly repeated twice. The order of numbers should be same as in list.(for example if 3 appeared before 2 3 should be printed first.) 

If no such number exist do not print anything. (input will be handled by us)


Input

[2,2,3,4,5,6,6,7,8,8,8,10, 3]


output

2

3

6


Explanation

Since 2, 3 and 6 is repeated 2 times output is 2, 3 and 6, whereas 8 is repeated 3 times so it is not printed.


num1 = int(input("Enter a Number: "))



num2 = int(input("Enter another Number: "))



operator = str(input("Enter the Operation you want: "))




if operator == "+":



print("Result is:" , (num1 + num2))




elif operator == "-":



print("Result is:" , (num1 - num2))




elif operator == "*":



print("Result is:" , (num1 * num2))




elif operator == "/":



print("Result is:" , (num1 / num2))




elif operator == "%":



print("Result is:" , (num1 % num2))




error in output: File "main.py", line 1, in <module>



num1 = int(input())



ValueError: invalid literal for int() with base 10:




n = int(input())
line = []

for i in range(0, n):
    line.append(input())
    print(max(line))
#test cases failed

Develop a custom class called Contact(Name, Dob, Phonenumber) which has methods such as Read() and Display() with the following criterions. Read Name (Text: maximum length 50), Dob(Date: after 01/01/2000) and



Phone numbers(Integer) from user and some of these accepting only a specific format with the four-digit area and six-digit local codes accepted as ten digits, or separated into blocks using hyphens or spaces, and with the area code optionally enclosed in parentheses.



For example, all of these are valid: 0426-123-456, (0432) 123456 and 0432



123456.



Read the phone numbers from console and for each one echo the number in the form "(999) 999 9999" or report an error for any that are invalid, or that don't have exactly ten digits.



Show how the object creations and manipulations are done for 'N' valid



Contacts.



Finally store the contacts in a separate .csv file

Write a program to print the following output


Input

The input is a single line string S.



Explanation

The input should be MATHEMATICS.

The output should be M A T H E I C S.


Sample Input1

MATHEMATICS

Sample output1

M A T H E I C S


Reverse of a number using recursion in python


Math Quiz


Write a program to print the following


Sample Input 1

1 3 4 5 6

5

3 5

Sample Output1

12



code for denominations 100, 50,10,1


 In a class test the teacher announces the marks (negative marking is allowed) of n (n>0) students. A student can achieve maximum 100 marks. Write a python function print_marks(*marks)  that takes number of students, marks of students and return the marks and check the marks are valid or not. If valid then it calls the recursive function rec_Sort(*marks) which returns the students marks as a comma-separated string with elements in ascending order. (You can use of built-in function max ()/min() to do this).

Example-1

Example-2

Example-3

Example-4

Example-5

Input:

5

6

56

58

 

Output:

5, 6, 56, 58

 

Input:

12

-3

45


37

90

Output:

-3, 0, 12, 37, 45, 90

Input:

56

96

100

101

Output:

Invalid Input

Input:

56

196

20

10

Output:

Invalid Input

Input:

50

40

10


Output:

0, 10, 40, 50

 




LATEST TUTORIALS
APPROVED BY CLIENTS