MovGP0    Über mich    Hilfen    Artikel    Weblinks    Literatur    Zitate    Notizen    Programmierung    MSCert    Physik   

Python

def mymethod(name):     if name == "Michael":        print("Hi old friend")    else:         print("Nice to meet you")def main():    mymethod("Michael")
 
import randomdef get_days():     # [] is List; not array    days = ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun']     return daysget_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()