####Demonstrate use of if statement ##x = int(input("Enter an integer: ")) ##if x%2 == 0: ## print("Even") ## print("Still in if suite") ##else: ## print("Odd") ## print("Outside of if statement") ##if x%3== 0: ## print("divisible by three") ####If statements can be nested ##x = int(input("Enter an integer: ")) ##if x%2 == 0: ## print("Even") ## if x%3 == 0: ## print("and divisible by 3") ## else: ## print("but not divisible by 3") ####check what happens if else is not indented. ####Demonstrates larger number of choices ##x = int(input("Enter your grade: ")) ##if x >= 90: ## print("You got an A!") ##elif x>=80: ## print("you got a B!") ##elif x>= 70: ## print("you got a C!") ##else: ## print("Too bad. Better luck next time.") #to be extended ####Demonstrates a basic while loop ##x = int(input("enter an integer")) ##i = 0; ##while i < x: ## print(i) ## i = i + 1 ####Try changing the loop so it counts down instead of up ####Demonstrates nested while loops ##x = int(input("enter an integer: ")) ##i = 0 ##while i < x: ## j = 0 ## while j <= i: ## print(j, end="") ## j+=1 ## print("") ## i+=1 ####Find the square root of a perfect square ##x = int(input('Enter an integer: ')) ##ans = 0 ##while ans*ans < x: ## ans += 1 ##if ans*ans == x: ## print("the square root of ",x," is ", ans) ##else: ## print(x, " is not a perfect square.") ####Square root function with a for loop ##x = int(input('Enter an integer: ')) ##for ans in range(0, abs(x)+1): ## if ans**2 == abs(x): ## break ##if ans**2 == x: ## print("The square root of ",x," is ", ans) ##else: ## print(x, " is not a perfect square") ####for statement used on a string ##x = input("Enter your name: ") ##for char in x: ## if char not in "aeiou": ## print(char, end="")