Skip to content

Find here some python codes for simple problems like Military Time,Vowel Digger, From minutes to Conventional Time, The Longest word ...

Notifications You must be signed in to change notification settings

cyrille-feu/Python-Codes-for-Simple-Problems

Repository files navigation

Python-Codes-for-Simple-Problems

Reverse your String

Write a function called ReveX that takes a string as input, and return a new string with the same letters in reverse order. Don’t use the .reverse() method, that would be too simple.

Solve the Factorial

Write a method called FactorX that takes an integer n a input and returns its factorial. Remember the formula of a factorial of a number n! = n ∗ (n − 1) ∗ (n − 2) ∗ (n − 3) ∗ ... ∗ 1 ##The Longest word Write a function called longest that takes a string (preferably a sentence) as input and returns the longest word in the string. You may assume that the string contains only letters and spaces.

Sum over my predecessors

Write a function called SumOverX that takes an integer as input and returns the sum over all the integers between zero and that integer, including it.

Four Digits Magic

Take any four-digit number,x. Rearrange the digits to make the largest possible number called x max . Also rearrange the digits to make the smallest possible number,x min . There is only one four-digit number for which x max −x min = x Find it.

From minutes to Conventional Time

Write a function called ClockX that takes as input a certain number of minutes,and returns a string that formats the number into ‘hours:minutes‘.

Vowel Digger

Write a function called VoweX that takes a string as input and returns the number of vowels in the string. You may assume that all the letters are lower cased. You can treat ”y” as a consonant.

Military Time

Write a function called Military that takes the time as string in AM/PM format and convert it to military (24-hour) time. Note: Midnight is 12:00:00AM on a 12-hour clock, and 00:00:00 on a 24-hour clock. Noon is 12:00:00PM on a 12-hour clock, and 12:00:00 on a 24-hour clock.

About

Find here some python codes for simple problems like Military Time,Vowel Digger, From minutes to Conventional Time, The Longest word ...

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages