Posts

STRING

Image
PROBLEM- Write a program which takes a student's ID as input and check if the student is in CSE AI with Robotics branch or not. The student's year of admission can range from 2018 to 2021. . Matching must be case insensitive. CODE- a=input() b=int(a[0:2]) if b in range(18,22):     c=a[2:5]     if c=='BRS' or c=='brs':         print('Yes')     else:         print('No') else:     print('No') OUTPUT- -------------------------------------------------------------------------------------------------------------------------------- PROBLEMS-   Sruthi has got the task to slicing the string S with N charecters and she has to find no of VOWELs in each slice. Your task is to help Sruthi to slice the given string S with N charecters and Display no of VOWELs each slice. Input Format First line contains a string s with out any spaces Second line contains integer N Constraints: string length <100 N<=10 Output For...

REGULAR EXPRESSION

Image
PROBLEM - Assume that you are entering a shopping mall with your car. You need to pay for parking vehicle. An operator was doing manual calculation for calculating the total hours spent. Help him do it automatically by writing a python code. Also mall opens by 8AM in the morning and clases by 12 in the night. No cars can be parked after 12. Upto 3 hours Rs.100 for every additional hour :Rs.40 Input Intime in the 24 hrs format outtime in 24 hrs format Output Amount in Rs Input : 10:00 22:20 Output : Rs.500 Input : 10AM 10:20 PM Output : Invalid Input CODE -  import re a=input() b=input() if (re.match("[0-2][0-9]+\:[0-2][0-9]",a)) and (re.match("[0-2][0-9]+\:[0-2][0-9]",b)):     if int(b[3:5])!=0:         time=int(b[0:2])-int(a[0:2])+1     else:         time=int(b[0:2])-int(a[0:2])     if time>3:         f=(time-3)*40+100     elif time==3:   ...