Skip to content

Instantly share code, notes, and snippets.

View sshehrozali's full-sized avatar
🌍

Shehroz Ali sshehrozali

🌍
View GitHub Profile
@sshehrozali
sshehrozali / string_reverse.py
Created November 9, 2020 18:53
Python code to reverse a string
# Prompt user to enter any name
name = input("Please enter any name: ")
# Print name in reverse order
print("Reversed: ", end="")
# Iterate till last char of string, print reversely
for i in range(1, len(name) + 1):
print(name[-i] ,end="")
@sshehrozali
sshehrozali / pyramid.py
Created November 9, 2020 18:47
Python code to print Left & Right aligned Pyramid
# Developed By Syed Shehroz Ali #
# Ask user for height of pyramid
height = input("Enter Height of Pyramid: ")
# -------------------------------------
# Start printing Left-aligned pyramid
print("\n----------------")
print("Left pyramid")
print("----------------")