leap year or not, divisible by 100 , 400(leap year)
divisible by 4 (non leap year i.e false
input:2016
output:true
code to display day name.
day_names= ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' , 'Sunday']
input:3
output:wednesday
Armstrong numbers between two intervals
Write a program to print all the Armstrong numbers in the given range
A to B(including A and B). An N-digit number is an Armstrong number if the number equals the sum of the Nth power of its digits.
Input
The first line has an integer
A. The second line has an integer B.
Output
Print all Armstrong numbers separated by a space.
If there are no Armstrong numbers in the given range, print
-1.
Explanation
For
A = 150 and B = 200
For example, if we take number 153, the sum of the cube of digits
1, 5, 3 is
13 + 53 + 33 = 153.
So, the output should be
153.
Sample Input 1
150
200
Sample Output 1
153
Sample Input 2
1
3
Sample Output 2
1 2 3
important: please tell me how can we print -1 if there is no armstrong number
Number Game
write a program to print the following
Input
The first line input containing the comma separated integers.
The second line of input is integer.
Sample Input1
1,2,3
1
Sample Output1
2 3
1 2
anil is given a sentence as he tries to make a sentence special a sentence can be made special by swapping the character with high frequency with the character having low frequency in the sentence help anil by transforming the sentence into. a special sentence in python.
swap most frequent letter with least given a sentence, swap the occurrences of the most frequenti with the least frequent letter and vice-versa. submisdong note: • consider upper and lower case letters as different . if there are multiple letters with the same frequency, choose the lower case letter that comes earliest in dictionary order o if letters like x and b have same frequency consider x o if letters like x and b have same frequency consider b.
Input: Python is a programming language
Output should be: Python is e progremming lenguega
Input : check your blood pressure frequently
Output : check ybur olbbd pressure frequently
Lowest and highest score. The teacher gave out the scores of the science quiz conducted last week and asked the ones with the lowest and highest scores to group up. Print the names of the students with minimum and maximum scores, respectively.
Note: In case of a tie, choose the name which comes first in the (dictionary order).
Input : 2
shakti 24
disha 26
output: shakti disha
input: 3
ajay 23
bijay 24
sanjay 23
output: ajay bijay
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: