Benutzer:MovGP0/Python

aus Wikipedia, der freien Enzyklopädie
Zur Navigation springen Zur Suche springen
   MovGP0        Über mich        Hilfen        Artikel        Weblinks        Literatur        Zitate        Notizen        Programmierung        MSCert        Physik      

def mymethod(name): 
    if name == "Michael":
        print("Hi old friend")
    else: 
        print("Nice to meet you")

def main():
    mymethod("Michael")
 
import random

def get_days(): 
    # [] is List; not array
    days = ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun'] 
    return days

get_random_report():
    weather = ['sunny', 'rainy', 'cold']
    index = random.randint(0, len(weather)-1)
    return weather[index]

def main():
    days = get_days()
    for day in days: 
        report = get_random_report()
        print("On {0} it will be {1}.".format(day, report))

if __name__ == "main"
    main()