5+9 print ("Tere Kevad") 56/5+99-14*9 print ("Tere Kevad") 3 > 7 for x in range (1,10): print (x)
# -*- coding: utf-8 -*- kaal = float(input("Kui palju sa umbes kaalud? ")) if kaal > 100: print("Tõenäoliselt oled natuke ülekaaluline.") elif kaal >50: print("OK või käib küll") else: print ("Oled alakaaluline või paremal juhul laps")
Muutke koodi nii, et:
import turtle for i in range(5): turtle.forward(50) turtle.right(144) import turtle turtle.pencolor("#3110BE") for i in range(50): turtle.forward(50) turtle.right(123) turtle.pencolor("#000000")
Muutke koodi nii, et:
import Tkinter as tk class Application(tk.Frame): def __init__(self, master=None): tk.Frame.__init__(self, master) self.pack() self.createWidgets() def createWidgets(self): self.hi_there = tk.Button(self) self.hi_there["text"] = "Olen aknaga programm\n(vajuta siia)" self.hi_there["command"] = self.say_hi self.hi_there.pack(side="top") self.QUIT = tk.Button(self, text="SULGE", fg="red",command=root.destroy) self.QUIT.pack(side="bottom") def say_hi(self): print("Tere kevad!") root = tk.Tk() app = Application(master=root) root.geometry("250x150+300+300") app.mainloop()
import RPi.GPIO as GPIO import time ledPin = 11 GPIO.setmode(GPIO.BOARD) GPIO.setup(ledPin, GPIO.OUT) while True: GPIO.output(ledPin, True)
Muutke koodi nii, et:
import RPi.GPIO as GPIO import time sensorPin = 7 GPIO.setmode(GPIO.BOARD) GPIO.setup(sensorPin, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) while True: time.sleep(0.1) print GPIO.input(sensorPin)
Muutke koodi nii, et:
https://www.raspberrypi.org/learning/parent-detector/worksheet/