Write a program that allows the user to input his/her full name (assuming that the last
word will be the surname). The program should then respond by telling the user the
following:
i) The number of names that he/she has.
ii) The user’s firstname.
iii) The user’s surname.
iv) The full name without the spaces.
v) The number of characters in the name.
vi) The number of unique characters in the name.
Write a Python program that does the following.
Part 2
Create your own examples using python lists
Provide the Python code and output for your program and all your examples.
Create a program that reads integers from the user until a blank line is entered. Once
all of the integers have been read your program should display all of the negative
numbers, followed by all of the zeros, followed by all of the positive numbers.Within
each group the numbers should be displayed in the same order that they were entered by the user. For example, if the user enters the values 3, -4, 1, 0, -1, 0, and -2 then
your program should output the values -4, -1, -2, 0, 0, 3, and 1.display each value on its own line.
I think it's already a given that two sentences combined will always be longer than a single sentence alone, but to prove just how long two sentences can be, why don't we let our program show the combined length of the two randomly inputted strings?
Let's get it on!
Input
Two lines containing a string on each.
Python·is·fun
I·love·CodeChum for i in range(0,len(displayList)):
#Test if the fist item in the current sub-list contains the text "Price Level
#Tip: Remeber that each sub-list is a (displayList). So you have
#to access its items via displayList followed by TWO indexes.
if i == "Price Level":
#Extract the second item from the current sub-list into variable called priceLevel
priceLevel = i
#Test if priceLevel is between previousPrice and currentPrice OR
# pL == pP OR
# pL == cP
if priceLevel >= previousPrice and priceLevel <= currentPrice or priceLevel == previousPrice or priceLevel == currentPrice:
if self.__currentPrice <= self.__previousPrice:
frequency = 400
duration = 700
#Sound the alarm. Pass in the frequency, duration.
else:
frequency = 800
duration = 700
winsound.Beep(frequency, duration)
#Print the text 'Alarm'
#can go back and check when the alarm was sounded.
print(Back.GREEN + "Alarm" + Style.RESET_ALL)
if __name__ == '__main__':
displayList = ['Price level']
play = Play()
# function call
play.ls(0, 100)In a right triangle, the square of the length of one side is equal to the sum of the squares of the lengths of the other two sides. Write a program that prompts the user to enter the length of the three sides of a triangle and then outputs a message indicating whether the triangle is a right triangle. Use functional programming paradigm on this problem.