Download File

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
PYTHON PROGRAM
import random
number = random.randint(1,100)
guess = 1000
Try = 0
myname = raw_input (" Hello! What is your name? ")
print ""
print " Welcome " + myname + " Are you up to guess my number? "
print ""
while (Try<100):
Try = Try + 1
guess = input (" Give me a number between 1 and 100 ")
if (guess>number):
print ""
print (" Try guessing a lower number ")
print ""
elif (guess<number):
print ""
print (" Try guessing a number that is higher ")
print ""
else:
print ""
print (" Congragulations!!!! You guessed my number!!! ")
PYTHON PROGRAM
print (' You have completed this in' , Try, 'tries ')
break
PYTHON PROGRAM
print("Do you want to know how long you have lived in Months, Days, Hours, Minutes, Seconds ")
name = raw_input("name: ")
print("now enter your age")
age = int(input("age: "))
months = age * 12
days = age * 365
hours = age * 24
minutes = age * 525948
seconds = age * 31556926
print(name, "has been alive for", months, "months", days, "days", hours, "hours", minutes, "minutes
and", seconds, "seconds! That is long!!”)
PYTHON PROGRAM
print (" Today we are going to convert Tempature ")
print ""
print (" These units are Fahrenheit amd Celsius ")
print ""
print (" We are going to be converting Fahrenheit to Celsius ")
Fahrenheit = int(raw_input("Enter a temperature in Fahrenheit: "))
Celsius = (Fahrenheit - 32) * 5/9
print "Temperature:", Fahrenheit, "Fahrenheit = ", Celsius, " C"
if (Fahrenheit<32):
print (" The weather is going to be cold be sure to pack warm clothes and expect some ice ")
print ""
elif (Fahrenheit>78):
print (" The weather is going to be warm be sure to wear sunscreen and sunglasses to protect your
eyes ")
print ""
else:
print (" The weather you are going to get is mild you can prepare by looking outside ")