Python Exercises

#1 - Create a variable named movie. Set it equal to your favorite movie. Movie = "Avengers:Endgame" #2 - Is the variable you created in Problem the first problem a String, Integer, or Float? It's a string, since "Avengers:Endgame" is a word. #3 - Print the variable named movie. print(movie) #4 - Create an integer variable x and set it equal to 10. x = 10 #5 - What type of variable is x? It is an integer variable since 10 is an integer (whole number). #6 - Create a variable called y and set it equal to 33.5. y = 33.5 #7 - What type of variable is y? y is a float, since 33.5 is a decimal number. #8 - Print the result of adding x and y together. print(x + y) Exercise 2 #1 name = "Elijah" age = 13 print("My name is " + name + ", and I'm " + str(age) + " years old.") #2 x = 20 print(x* 20) #3 decimal = "22.5" decimal = float(decimal) result = decimal * 4 print(result) Exercise 3 print("Hi I Am COE Which Is Calculator 0f Elijah") num1 = int(input("Type Your First Number:")) num2 = int(input ("Type Your Second Number:")) num3 = int(input ("Type Your Third Number:")) operator =(input ("Type a Operator:")) if (operator == "-"): answer = num1 - num2 - num3 elif (operator == "+"): answer = num1 + num2 + num3 elif (operator == "*"): answer = num1 * num2 * num3 elif (operator == "/"): answer = num1 / num2 / num3 print ("Here is the Answer:", answer) Exercise 4 #1 N=int(input("Enter the side of the square: ")) Area=N*N Perimeter=4*N print(Area) print(Perimeter) #2 FN = input("Type your First Name : ") LN = input("Type your Last Name : ") print ("Hello, " + FN + " " + LN) #3 str = input("Enter a string: ") print("Length of the input string is:", len(str)) #4 print("Input lengths of the triangle sides: ") x = int(input("x: ")) y = int(input("y: ")) z = int(input("z: ")) if x == y == z: print("Equilateral triangle") elif x==y or y==z or z==x: print("Obtuse/Scalene triangle") else: print("Scalene triangle") #5 days = int(input("Please enter days:")) seconds = days * 24 * 60 * 60 print(seconds, " Seconds") #6 num1 = float(input("Enter first number: ")) num2 = float(input("Enter second number: ")) num3 = float(input("Enter third number: ")) if (num1 >= num2) and (num1 >= num3): largest = num1 elif (num2 >= num1) and (num2 >= num3): largest = num2 else: largest = num3 print("The largest number is", largest) #9 numberOfWordsInList = int(input("Enter number of words to be List: ")) def longestWordInList(numberOfWordsInListt): createdList = [input("Enter any word: ") for i in range(numberOfWordsInList)] lengthOfItems = [(len(items), items) for items in createdList] return max(lengthOfItems) print(longestWordInList(numberOfWordsInList))

AT-BASH CIPHER

my take on AT-BASH CIPHER

https://repl.it/join/nyoobkmd-supython3
#for the effects import time #asking the user to input the sentence print("") print("THIS IS THE AT-BASH CIPHER AND PRESS ENTER") time.sleep(1) print("") print("PLEASE TYPE IN LOWERCASE OR ELSE THE PROGRAM WON'T WORK") cipher = input("TYPE IN YOUR SENTENCE THAT YOU WANT TO SCRAMBLE: ") time.sleep(1) print("caculating.....") #replacing each letter cipher = cipher.replace("a", "Z") cipher = cipher.replace("b", "Y") cipher = cipher.replace("c", 'X') cipher = cipher.replace("d", 'W') cipher = cipher.replace("e", 'V') cipher = cipher.replace("f", 'U') cipher = cipher.replace("g", 'T') cipher = cipher.replace("h", 'S') cipher = cipher.replace("i", 'R') cipher = cipher.replace("j", 'Q') cipher = cipher.replace("k", 'P') cipher = cipher.replace("l", 'O') cipher = cipher.replace("m", 'N') cipher = cipher.replace("n", 'M') cipher = cipher.replace("o", 'L') cipher = cipher.replace("p", 'K') cipher = cipher.replace("q", 'J') cipher = cipher.replace("r", 'I') cipher = cipher.replace("s", 'H') cipher = cipher.replace("t", 'G') cipher = cipher.replace("u", 'F') cipher = cipher.replace("v", 'E') cipher = cipher.replace("w", 'D') cipher = cipher.replace("x", 'C') cipher = cipher.replace("y", 'B') cipher = cipher.replace("z", 'A') #displaying the ciphered text time.sleep(3) print("caculating.......") print("") time.sleep(3) print("") print("YOUR SENTENCE IS:") time.sleep(2) print("") print(cipher) print("")
A Nov 22

Interesting

1