0% found this document useful (0 votes)
57 views7 pages

Challenge1 50

This document contains Python code examples that demonstrate using conditionals like if/else statements and loops like for and while to control program flow. The code covers topics like taking user input, comparing values, printing outputs, and iterating through ranges. Overall the examples show the basic building blocks of programming logic and control structures.

Uploaded by

qweerty
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
57 views7 pages

Challenge1 50

This document contains Python code examples that demonstrate using conditionals like if/else statements and loops like for and while to control program flow. The code covers topics like taking user input, comparing values, printing outputs, and iterating through ranges. Overall the examples show the basic building blocks of programming logic and control structures.

Uploaded by

qweerty
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 7

#age = int(input("what is your age"))

#if age >18:


# print("you can vote")
#elif age ==17:
# print("you can lean to drive")
#elif age ==16:
# print("you can buy a lottery ticket")
#else:
# print("you can go trick or treating")

#num = int(input("enter a number"))


#if num <10:
# print("too low")
#elif num >10 and num <20:
# print("correct")
#else:
# print("too high")

#num = int(input("enter either 1,2,3"))


#if num == 1:
# print("thank you")
#elif num==2:
# print("well done")
#elif num ==3:
# print("correct")
#else:
# print("error")

#name = input("enter your first name")


#print(len(name))

#firstname = input("what is your first name")


#surname = input("what is your surname")
#print(firstname, surname)
#print(len(firstname+surname))

#rhyme = input("type a nursery rhyme")


#print(len(rhyme))
#start = int(input("enter the starting number"))
#end = int(input("enter the ending number"))
#print(rhyme[start:end])

#word = input("type any word")


#print(word.upper())

#firstname = input("what is your first name")


#if len(firstname)<5:
# surname = input("what is your surname")
# print(firstname.upper()+surname)
#else:
# print(firstname.lower())

#vowels = ["a","e","i","o","u"]
#word = input("enter a word")
#i=0
#con = False
#while con == False:
# if word[i] in vowels:
# i = i+1
# else:
# word = word[i].pop()
# word = word.append(word[i])
# con == True
#i=0
#if word[i] in vowels:
# word = word.append(way)
#else:
# word = word.append(ay)
#print(word.lower())

#num = float(input("enter a number"))


#num = num * 2
#print(round(num,2))

#import math
#num = int(input("enter a number over 500"))
#num = math.sqrt(num)
#print(round(num,2))

#import math
#pi = math.pi
#print(round(pi,5))

#import math
#radius = int(input("enter a radius"))
#pi = math.pi
#area = pi * radius**2
#print(area)

#import math
#radius = int(input("enter a radius"))
#depth = int(input("enter a depth"))
#pi = math.pi
#volume = pi * radius**2 * depth
#print(round(volume,3))

#num1 = int(input("enter a number"))


#num2 = int(input("enter another number"))
#divide = num1 // num2
#remainder = num1 % num2
#print(num1,"divided by", num2,"is",divide,"with",remainder,"remaining")

#shape =int(input("1) Square \n2) Triangle \nEnter a number:"))


#if shape == 1:
# side = int(input("side length:"))
# print(side*side)
#elif shape == 2:
# base = int(input("base:"))
# height = int(input("height:"
# ))
# print(base*height /2)
#else:
# print("error")

#name = input("what is your name")


#num1 = int(input("enter a number"))
#for i in range(1,num1):
# print(name)

#name = input("what is your name")


#num1 = int(input("enter a number"))
#for i in range (num1):
# for i in(name):
# print(i)

#num1 = int(input("enter a number between 1-12"))


#for i in range(1,13,1):
# print(i*num1)
# i=i+1

#num1 = int(input("enter a number below 50"))


#for i in range(50,num1-1,-1):
# print(i)
# i=i+1

#name = input("what is your name")


#num1 = int(input("enter a number"))
#if num1 <10:
# for i in range(1,num1+1,1):
# print(name)
# i=i+1
#else:
# for i in range(1,4,1):
# print("too large")

#totalto0 = 0
#for i in range(1,6,1):
# num1 = int(input("enter a number"))
# choice = input("do u want this number added")
# if choice == "yes":
# totalto0 = totalto0+num1
# else:
# totalto0 = totalto0
#print(totalto0)

#direction = input("do you want to go up or down")


#if direction == "up":
# num1 = int(input("enter top number"))
# for i in range(1,num1+1,1):
# print(i)
#elif direction == "down":
# num1 = int(input("enter a number below 20"))
# for i in range(20,num1-1,-1):
# print(i)
#else:
# print("I don't understand")

#num1 = int(input("how many do u want to invite to party"))


#if num1 <10:
# for i in range(1,num1+1,1):
# name = input("what is their name")
# print(name, "has been invited")
#if num1 >10:
# print("too many people")

#total =0
#while total <= 50:
# num1 = int(input("enter a number"))
# total = total + num1
# print("the total is",total)

#num1 = int(input("enter a number"))


#while num1 <5:
# num1 = int(input("enter a number"))
#print("the last number you entered was", num1)

#num1 = int(input("enter a number"))


#num2 = int(input("enter another number"))
#total = num1+num2
#choice = input("do you want to add another number")
#while choice == "y":
# num2 = int(input("enter another number"))
# total = total+num2
# choice = input("do you want to add another number")
#print(total)

#count = 1
#name = input("who do you want to invite")
#print(name,"has been invited")
#choice = input("do you want to invite anyone else")
#while choice == "yes":
# count = count+1
# name = input("who do you want to invite")
# print(name,"has been invited")
# choice = input("do you want to invite anyone else")
#print("you have invited ",count,"people")

#compnum = 50
#count=1
#num1 = int(input("enter a number"))
#while num1 != compnum:
# if num1 <compnum:
# print("too low")
# count = count +1
# num1 = int(input("enter a number"))
# else:
# print("too high")
# num1 = int(input("enter a number"))
#print("well done it took you",count,"attempts")

#num1 = int(input("enter a number"))


#while num1 <10 or num1 >20:
# if num1 <10:
# print("too low")
# else:
# print("too high")
# num1 = int(input("enter a number"))
#print("thank you")

#num =10
#while num !=0:
# print("there are",num,"green bottles hanging on the wall",num,"green bottles
hanging on the wall and if 1 green bottle should accidentaly fall")
# num = int(input("how many green bottles will be hanging on the wall?"))
# if num == num -1:
# print("there are",num,"green bottles hanging on the wall",num,"green
bottles hanging on the wall and if 1 green bottle should accidentaly fall")
# num = int(input("how many green bottles will be hanging on the wall?"))
# else:
# print("No, try again")
# num = int(input("how many green bottles will be hanging on the wall?"))
#print("there are no more green bottles hanging on the wall")

You might also like